示例#1
0
        public GLProgramParameter(string vShaderFileName, string fShaderFileName)
        {
            GLProgram = new GLProgram(vShaderFileName, fShaderFileName);

            GLProgram.AddAttribute("position");
            GLProgram.AddAttribute("normal");
            GLProgram.AddAttribute("textureCoordinates");

            if (!GLProgram.Link())
            {
                Debug.WriteLine("Link failed.");
                Debug.WriteLine(string.Format("GLProgram Log: {0}", GLProgram.ProgramLog()));
                Debug.WriteLine(string.Format("Fragment Log: {0}", GLProgram.FragmentShaderLog()));
                Debug.WriteLine(string.Format("Vertex Log: {0}", GLProgram.VertexShaderLog()));

                GLProgram = null;
                return;
            }

            PositionAttribute           = GLProgram.GetAttributeIndex("position");
            NormalAttribute             = GLProgram.GetAttributeIndex("normal");
            TextureCoordinateAttribute  = GLProgram.GetAttributeIndex("textureCoordinates");
            WorldMatrixUniform          = GLProgram.GetUniformIndex("world");
            ViewProjectionMatrixUniform = GLProgram.GetUniformIndex("viewProjection");
            LightDirectionMatrixUniform = GLProgram.GetUniformIndex("lightDirection");
            TextureUniform = GLProgram.GetUniformIndex("texture");

            GLProgram.Use();
        }
示例#2
0
 public void Use()
 {
     GLProgram.Use();
 }