//////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2011, Computer Graphics Group RWTH Aachen University // // All rights reserved. // //////////////////////////////////////////////////////////////////////////////// #include #include #include using namespace ACGL::GLUtils; using namespace ACGL::GLUtils::Tools; using namespace ACGL::Utils; using namespace ACGL::Resource; bool ShaderProgram::link(void) const { glLinkProgram(mContext); if ( openGLRareErrorOccured() ) { // it's uncommon that this fails, compile errors (the most common errors) // are not checked here! return false; } // check for shader compile errors: GLint error; glGetProgramiv(mContext, GL_LINK_STATUS, &error); if (error != GL_TRUE) { // yes, errors :-( GLsizei length = 0; glGetProgramiv(mContext, GL_INFO_LOG_LENGTH, &length); if (length > 1) { GLchar* pInfo = new char[length + 1]; glGetProgramInfoLog(mContext, length, &length, pInfo); openGLRareError(); message() << "Linker Error: " << std::string(pInfo) << std::endl; delete[] pInfo; return false; } } return true; }