Microsoft.Xna.Framework.Graphics.Shader.GetVertexAttributeLocations C# (CSharp) Method

GetVertexAttributeLocations() private method

private GetVertexAttributeLocations ( int program ) : void
program int
return void
        internal void GetVertexAttributeLocations(int program)
        {
            for (int i = 0; i < _attributes.Length; ++i)
            {
                _attributes[i].location = GL.GetAttribLocation(program, _attributes[i].name);
                GraphicsExtensions.CheckGLError();
            }
        }

Usage Example

Beispiel #1
0
        private void Link(Shader vertexShader, Shader pixelShader)
        {
            int program = GL.CreateProgram();

            GL.AttachShader(program, vertexShader.GetShaderHandle());
            GL.AttachShader(program, pixelShader.GetShaderHandle());
            GL.LinkProgram(program);
            GL.UseProgram(program);
            vertexShader.GetVertexAttributeLocations(program);
            pixelShader.ApplySamplerTextureUnits(program);
            int @params = 0;

            GL.GetProgram(program, ProgramParameter.LinkStatus, out @params);
            if (@params == 0)
            {
                Console.WriteLine(GL.GetProgramInfoLog(program));
                throw new InvalidOperationException("Unable to link effect program");
            }
            else
            {
                ShaderProgramInfo shaderProgramInfo;
                shaderProgramInfo.program     = program;
                shaderProgramInfo.posFixupLoc = GL.GetUniformLocation(program, "posFixup");
                this._programCache.Add(vertexShader.HashKey | pixelShader.HashKey, shaderProgramInfo);
            }
        }
All Usage Examples Of Microsoft.Xna.Framework.Graphics.Shader::GetVertexAttributeLocations