Changeset 5264 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Sep 27, 2005, 1:00:35 AM (19 years ago)
- Location:
- trunk/src/lib/graphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/graphics_engine.cc
r5263 r5264 274 274 PRINTF(4)("Status: Using GLEW %s\n", glewGetString(GLEW_VERSION)); 275 275 276 Shader* shader = new Shader("test.txt" );277 shader->debug();278 delete shader;279 //exit(-1);276 Shader* shader = new Shader("test.txt", "shader.cg"); 277 // delete shader; 278 shader->activateShader(); 279 exit(-1); 280 280 281 281 } -
trunk/src/lib/graphics/shader.cc
r5263 r5264 56 56 if (fragmentShaderFile != NULL) 57 57 this->loadShaderProgramm(SHADER_FRAGMENT, fragmentShaderFile); 58 glLinkProgramARB(this->shaderProgram); 59 this->printError(this->shaderProgram); 60 58 61 } 59 62 … … 108 111 // get next line 109 112 fgets (lineBuffer, PARSELINELENGHT, stream); 110 if (strchr(lineBuffer, '\n'))111 {112 addString = new char[strlen(lineBuffer)];113 strncpy(addString, lineBuffer, strlen (lineBuffer)-1);114 addString[strlen(lineBuffer)-1] ='\0';115 }116 else113 // if (strchr(lineBuffer, '\n')) 114 // { 115 // addString = new char[strlen(lineBuffer)]; 116 // strncpy(addString, lineBuffer, strlen (lineBuffer)-1); 117 // addString[strlen(lineBuffer)-1] ='\0'; 118 // } 119 // else 117 120 { 118 121 addString = new char[strlen(lineBuffer)+1]; … … 133 136 glCompileShaderARB(this->vertexShader); 134 137 glAttachObjectARB(this->shaderProgram, this->vertexShader); 138 this->printError(this->vertexShader); 135 139 } 136 140 … … 141 145 glCompileShaderARB(this->fragmentShader); 142 146 glAttachObjectARB(this->shaderProgram, this->fragmentShader); 143 }144 glLinkProgramARB(this->shaderProgram);147 this->printError(this->fragmentShader); 148 } 145 149 } 146 150 … … 192 196 } 193 197 198 199 void Shader::printError(GLenum program) 200 { 201 GLint length = 5000; 202 // glGetObjectParameterARBfiv(program, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); 203 char* text = new char[length+1]; 204 glGetInfoLogARB(program, length, &length, text); 205 printf("%s\n", text); 206 delete[] text; 207 } 208 209 210 194 211 void Shader::debug() const 195 212 { -
trunk/src/lib/graphics/shader.h
r5263 r5264 34 34 void deleteProgram(SHADER_TYPE type); 35 35 36 void printError(GLenum program); 36 37 void debug() const; 37 38
Note: See TracChangeset
for help on using the changeset viewer.