public void Render(Camera Camera) { if (triangle == null) { triangle = new ScreenTriangle(); } if (textureShader == null) { textureShader = new Shader(); textureShader.LoadShader(File.ReadAllText("Shaders/Texture.frag"), OpenTK.Graphics.OpenGL.ShaderType.FragmentShader); textureShader.LoadShader(File.ReadAllText("Shaders/Texture.vert"), OpenTK.Graphics.OpenGL.ShaderType.VertexShader); textureShader.LoadShader(File.ReadAllText("Shaders/Gamma.frag"), OpenTK.Graphics.OpenGL.ShaderType.FragmentShader); } // Texture unit 0 should be reserved for image preview. textureShader.UseProgram(); if (renderTexture != null) { textureShader.SetTexture("image", renderTexture, 0); } // The colors need to be converted back to sRGB gamma. textureShader.SetBoolToInt("isSrgb", IsSrgb); triangle.Draw(textureShader, null); }
public static void DrawGradient(Vector3 colorBottom, Vector3 colorTop) { if (triangle == null) { triangle = new ScreenTriangle(); } var shader = ShaderContainer.GetShader("ScreenGradient"); shader.UseProgram(); shader.SetVector3("colorTop", colorTop); shader.SetVector3("colorBottom", colorBottom); triangle.Draw(shader); }
public static void DrawTexture(Texture texture) { if (triangle == null) { triangle = new ScreenTriangle(); } var shader = ShaderContainer.GetShader("ScreenTexture"); shader.UseProgram(); // TODO: Add a sampler to this class and use that instead. // TODO: Samplers are bound from the previous model drawing. GL.BindSampler(0, 0); shader.SetTexture("image", texture, 0); triangle.Draw(shader); }
public void Render(Camera camera) { if (triangle == null) { triangle = new ScreenTriangle(); } // Texture unit 0 should be reserved for image preview. var shader = ShaderContainer.GetShader("RTexture"); shader.UseProgram(); if (SfTexture != null) { shader.SetTexture("image", SfTexture, 0); } // The colors need to be converted back to sRGB gamma. shader.SetBoolToInt("isSrgb", IsSrgb); triangle.Draw(shader); }
public static void DrawBloomCombined(Texture colorTex, Texture colorBrightTex) { if (triangle == null) { triangle = new ScreenTriangle(); } var shader = ShaderContainer.GetShader("ScreenBloomCombined"); shader.UseProgram(); // TODO: Samplers are bound from the previous model drawing. GL.BindSampler(0, 0); GL.BindSampler(1, 0); shader.SetTexture("colorTex", colorTex, 0); shader.SetTexture("colorBrightTex", colorBrightTex, 1); shader.SetBoolToInt("enableBloom", RenderSettings.Instance.EnableBloom); shader.SetFloat("bloomIntensity", RenderSettings.Instance.BloomIntensity); triangle.Draw(shader); }
public static void DrawTexture(Texture texture) { if (triangle == null) { triangle = new ScreenTriangle(); } if (sampler == null) { sampler = new SamplerObject { MagFilter = TextureMagFilter.Nearest, MinFilter = TextureMinFilter.Nearest } } ; var shader = ShaderContainer.GetShader("ScreenTexture"); shader.UseProgram(); sampler.Bind(0); shader.SetTexture("image", texture, 0); triangle.Draw(shader); }