using System; using System.Runtime.InteropServices; using SDL2; using SlatedGameToolkit.Framework.Exceptions; using SlatedGameToolkit.Framework.Graphics.Window; namespace SlatedGameToolkit.Framework.Graphics.OpenGL.Shaders { public class GLFragmentShader : GLShader { public GLFragmentShader(WindowContext context, string shader) : base() { Handle = createShader(GLEnums.GL_FRAGMENT_SHADER); shaderSource(Handle, 1, shader, null); compileShader(Handle); uint logLength; string shaderLog; getShaderLogInfo(Handle, 1024, out logLength, out shaderLog); if (logLength > 0) { Dispose(); throw new OpenGLException(shaderLog); } } public override void Dispose() { deleteShader(Handle); } ~GLFragmentShader() { Dispose(); } } }