Exemplo n.º 1
1
        private void linkProgram(OpenGL gl, ActiveProgramValues programValues, uint glProgramHandle)
        {
            //TODO add debug assertions in case a shader fails to compile, or a program fails to link
            var glShaderHandles = new List<uint>(programValues.AttachedShaderValues.Count);
            foreach (var shaderValues in programValues.AttachedShaderValues)
            {
            var glShaderHandle = gl.CreateShader(shaderValues.Stage.GlEnumValue());
            glShaderHandles.Add(glShaderHandle);

            gl.ShaderSource(glShaderHandle, shaderValues.Source);
            gl.CompileShader(glShaderHandle);

            gl.AttachShader(glProgramHandle, glShaderHandle);
            }

            gl.LinkProgram(glProgramHandle);

            foreach (var glShaderHandle in glShaderHandles)
            {
            gl.DetachShader(glProgramHandle, glShaderHandle);
            gl.DeleteShader(glShaderHandle);
            }
        }
Exemplo n.º 2
0
 private void resetActiveProgramValues()
 {
     lock (this)
     {
     activeProgramValues = new ActiveProgramValues(activeProgram);
     }
 }