Example/GLSL Program Link Error Testing

GLuintprogram=glCreateProgram();// Attach shaders as necessary.glAttachShader(program,...);...// Link the program.glLinkProgram(program);GLintisLinked=0;glGetProgramiv(program,GL_LINK_STATUS,&isLinked);if(isLinked==GL_FALSE){GLintmaxLength=0;glGetProgramiv(program,GL_INFO_LOG_LENGTH,&maxLength);// The maxLength includes the NULL characterstd::vector<GLchar>infoLog(maxLength);glGetProgramInfoLog(program,maxLength,&maxLength,&infoLog[0]);// The program is useless now. So delete it.glDeleteProgram(program);// Provide the infolog in whatever manner you deem best.// Exit with failure.return;}