public static void RenderTexture(Texture renderTexture, bool displayR, bool displayG, bool displayB, bool displayA, int LOD, bool IsSrgb = false) { if (triangle == null) { triangle = new ScreenTriangle(); } // Texture unit 0 should be reserved for image preview. var shader = ShaderManager.GetShader("Texture"); shader.UseProgram(); if (renderTexture != null) { shader.SetTexture("image", renderTexture, 0); } GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (float)TextureMagFilter.Nearest); // The colors need to be converted back to sRGB gamma. shader.SetBoolToInt("isSrgb", IsSrgb); bool monoChannel = false; if (displayR && !displayG && !displayB && !displayA) { monoChannel = true; } if (!displayR && displayG && !displayB && !displayA) { monoChannel = true; } if (!displayR && !displayG && displayB && !displayA) { monoChannel = true; } if (!displayR && !displayG && !displayB && displayA) { monoChannel = true; } shader.SetBoolToInt("enableR", displayR); shader.SetBoolToInt("enableG", displayG); shader.SetBoolToInt("enableB", displayB); shader.SetBoolToInt("enableA", displayA); shader.SetBoolToInt("monoChannel", monoChannel); shader.SetInt("LOD", LOD); triangle.Draw(shader); }
public static void RenderTexture(Texture renderTexture, bool IsSrgb = false) { if (triangle == null) { triangle = new ScreenTriangle(); } // Texture unit 0 should be reserved for image preview. var shader = ShaderManager.GetShader("Texture"); shader.UseProgram(); if (renderTexture != null) { shader.SetTexture("image", renderTexture, 0); } // The colors need to be converted back to sRGB gamma. shader.SetBoolToInt("isSrgb", IsSrgb); triangle.Draw(shader, null); }