Exemple #1
0
        public Shader(OpenGL gl, string vertexShaderSource, string fragmentShaderSource,
            Dictionary<uint, string> attributeLocations)
        {
            this.gl = gl;

            Compiled = false;
            CompilerOutput = null;

            shader = new SharpGL.Shaders.ShaderProgram();
            try
            {
                shader.Create(gl, vertexShaderSource, fragmentShaderSource, attributeLocations);
            }
            catch (SharpGL.Shaders.ShaderCompilationException ex)
            {
                CompilerOutput = ex.CompilerOutput;
                return;
            }

            try
            {
                shader.AssertValid(gl);
            }
            catch (Exception ex)
            {
                CompilerOutput = ex.Message;
                return;
            }

            Compiled = true;
        }
Exemple #2
0
        public Shader(OpenGL gl, string vertexShaderSource, string fragmentShaderSource,
                      Dictionary <uint, string> attributeLocations)
        {
            this.gl = gl;

            Compiled       = false;
            CompilerOutput = null;

            shader = new SharpGL.Shaders.ShaderProgram();
            try
            {
                shader.Create(gl, vertexShaderSource, fragmentShaderSource, attributeLocations);
            }
            catch (SharpGL.Shaders.ShaderCompilationException ex)
            {
                CompilerOutput = ex.CompilerOutput;
                return;
            }

            try
            {
                shader.AssertValid(gl);
            }
            catch (Exception ex)
            {
                CompilerOutput = ex.Message;
                return;
            }

            Compiled = true;
        }