Changeset 5320 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Oct 8, 2005, 3:31:18 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/shader.cc
r5319 r5320 47 47 if (GLEW_ARB_shader_objects && GLEW_ARB_shading_language_100) 48 48 { 49 GLint status = 0; 50 49 51 this->shaderProgram = glCreateProgramObjectARB(); 50 52 … … 53 55 if (fragmentShaderFile != NULL) 54 56 this->loadShaderProgramm(SHADER_FRAGMENT, fragmentShaderFile); 55 try { 56 glLinkProgramARB(this->shaderProgram); } 57 catch(GLenum errorCode) { 58 this->printError(this->shaderProgram); } 59 } 57 glLinkProgramARB(this->shaderProgram); 58 // link error checking 59 glGetObjectParameterivARB(this->shaderProgram, GL_OBJECT_LINK_STATUS_ARB, &status); 60 if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION) 61 this->printError(this->shaderProgram); 62 } 60 63 else 61 64 { … … 120 123 if (shader != 0) 121 124 { 125 GLint status = 0; 122 126 glShaderSourceARB(shader, program->getCount(), (const GLcharARB**)program->getArray(), NULL); 123 glCompileShaderARB(shader); 124 this->printError(shader); 125 glAttachObjectARB(this->shaderProgram, shader); 127 glCompileShaderARB(shader); 128 // checking on error. 129 glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status); 130 if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION) 131 this->printError(shader); 132 else 133 glAttachObjectARB(this->shaderProgram, shader); 126 134 } 127 135 for (unsigned int i=0; i< program->getCount(); i++) … … 201 209 void Shader::deleteProgram(SHADER_TYPE type) 202 210 { 211 GLint status; 203 212 if (type == SHADER_VERTEX && this->vertexShader != 0) 204 213 { … … 206 215 this->vertexShaderFile = NULL; 207 216 glDeleteObjectARB(this->vertexShader); 217 glGetObjectParameterivARB(this->vertexShader, GL_OBJECT_DELETE_STATUS_ARB, &status); 218 if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION) 219 Shader::printError(this->vertexShader); 208 220 this->vertexShader = 0; 209 221 } … … 213 225 this->fragmentShaderFile = NULL; 214 226 glDeleteObjectARB(this->fragmentShader); 227 glGetObjectParameterivARB(this->fragmentShader, GL_OBJECT_DELETE_STATUS_ARB, &status); 228 if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION) 229 Shader::printError(this->fragmentShader); 215 230 this->fragmentShader = 0; 216 231 }
Note: See TracChangeset
for help on using the changeset viewer.