private 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);
        }
Ejemplo n.º 2
0
 protected void LoadShader(string filename, ShaderType type, int program, out int address)
 {
     if (!File.Exists(filename))
     {
         Console.WriteLine($"File not found: {filename}");
         address = -1;
         return;
     }
     address = GL.CreateShader(type);
     using (var sr = new StreamReader(filename))
     {
         GL.ShaderSource(address, sr.ReadToEnd());
     }
     GL.CompileShader(address);
     GL.AttachShader(program, address);
     Console.WriteLine(GL.GetShaderInfoLog(address));
 }