Пример #1
0
        public static int CreateShader(string shaderSource, ShaderType type)
        {
            int shaderHandle = GL.CreateShader(type);

            GL.ShaderSource(shaderHandle, shaderSource);
            GL.CompileShader(shaderHandle);
            Console.WriteLine(GL.GetShaderInfoLog(shaderHandle));
            return(shaderHandle);
        }
Пример #2
0
        private int loadShader(ShaderType type, string file)
        {
            try
            {
                string ext = type == ShaderType.VertexShader ? ".vsh" : ".fsh";

                int ID = GL.CreateShader(type);

                var text = File.ReadAllText(file + ext);

                GL.ShaderSource(ID, text);
                GL.CompileShader(ID);

                GL.GetShader(ID, ShaderParameter.CompileStatus, out var status);

                return(status != -1 ? ID : -1);
            }
            catch
            {
                return(-1);
            }
        }
Пример #3
0
 public void CompileShader(GLShaderHandle shader)
 {
     GL.CompileShader((int)shader);
 }