internal static int LinkShaders(IGLGraphicsPipelineEntrypoint entrypoint, IGLErrorHandler errHandler, int[] shaders) { int retVal = entrypoint.CreateProgram(); foreach (var shader in shaders) { entrypoint.AttachShaderToProgram(retVal, shader); //GL.AttachShader (retVal, shader); } entrypoint.CompileProgram(retVal); bool isCompiled = entrypoint.IsCompiled(retVal); //int linkStatus = 0; //GL.GetProgram(retVal,GetProgramParameterName.LinkStatus, out linkStatus); // return (linkStatus == (int)All.True) //int glinfoLogLength = 0; //GL.GetProgram(retVal, GetProgramParameterName.InfoLogLength, out glinfoLogLength); // return (glinfoLogLength > 1) bool hasMessages = entrypoint.HasCompilerMessages(retVal); if (hasMessages) { string buffer = entrypoint.GetCompilerMessages(retVal); // GL.GetProgramInfoLog(retVal); if (!isCompiled) { errHandler.Trace("Shader Linking failed with the following errors:"); } else { errHandler.Trace("Shader Linking succeeded, with following warnings/messages:\n"); } errHandler.Trace(buffer); } if (!isCompiled) { // #ifndef POSIX // assert(!"Shader failed linking, here's an assert to break you in the debugger."); // #endif entrypoint.DeleteProgram(retVal); retVal = 0; } return(retVal); }