- Timestamp:
- Sep 27, 2005, 6:51:07 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/shader.cc
r5268 r5269 52 52 try { 53 53 glLinkProgramARB(this->shaderProgram); } 54 catch( char* str) {54 catch(GLenum errorCode) { 55 55 this->printError(this->shaderProgram); } 56 56 } … … 80 80 81 81 const char* program = fileRead(fileName); 82 82 GLenum shader = 0; 83 83 if (type == SHADER_VERTEX && GLEW_ARB_vertex_shader) 84 84 { … … 86 86 strcpy(this->vertexShaderFile, fileName); 87 87 88 this->vertexShader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); 89 try { 90 glShaderSourceARB(this->vertexShader, 1, (const GLcharARB**)&program, NULL); 91 glCompileShaderARB(this->vertexShader); 92 glAttachObjectARB(this->shaderProgram, this->vertexShader); 93 } 94 catch (char * tmp) 95 { 96 this->printError(this->vertexShader); 97 } 88 shader = this->vertexShader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); 98 89 } 99 90 … … 103 94 strcpy(this->fragmentShaderFile, fileName); 104 95 105 this->fragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); 106 try 107 { 108 glShaderSourceARB(this->fragmentShader, 1, (const GLcharARB**)&program, NULL); 109 glCompileShaderARB(this->fragmentShader); 110 glAttachObjectARB(this->shaderProgram, this->fragmentShader); 111 } 112 catch (char* tmp) 113 { 114 this->printError(this->fragmentShader); 115 } 116 } 117 96 shader = this->fragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); 97 } 98 glShaderSourceARB(shader, 1, (const GLcharARB**)&program, NULL); 99 try { 100 glCompileShaderARB(shader); 101 } 102 catch (...) 103 { 104 this->printError(shader); 105 } 106 glAttachObjectARB(this->shaderProgram, shader); 118 107 delete[] program; 119 108 } … … 190 179 if (infologLength > 0) 191 180 { 192 infoLog = (char *)malloc( infologLength);181 infoLog = (char *)malloc(sizeof(char) * (infologLength+1)); 193 182 glGetInfoLogARB(program, infologLength, &charsWritten, infoLog); 194 printf("%s\n", infoLog);183 printf("%s\n", infoLog); 195 184 free(infoLog); 196 185 } -
trunk/src/world_entities/npc2.cc
r5268 r5269 33 33 this->loadModelWithScale("models/ships/bolido.obj", 3); 34 34 this->shader = new Shader("toon.vert", "toon.frag"); 35 //this->shader->activateShader();35 this->shader->activateShader(); 36 36 //exit(-1); 37 37
Note: See TracChangeset
for help on using the changeset viewer.