Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5269 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
Sep 27, 2005, 6:51:07 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: flushing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/shader.cc

    r5268 r5269  
    5252  try  {
    5353   glLinkProgramARB(this->shaderProgram); }
    54   catch(char* str)  {
     54  catch(GLenum errorCode)  {
    5555   this->printError(this->shaderProgram); }
    5656}
     
    8080
    8181  const char* program = fileRead(fileName);
    82 
     82  GLenum shader = 0;
    8383  if (type == SHADER_VERTEX && GLEW_ARB_vertex_shader)
    8484  {
     
    8686    strcpy(this->vertexShaderFile, fileName);
    8787
    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);
    9889  }
    9990
     
    10394    strcpy(this->fragmentShaderFile, fileName);
    10495
    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);
    118107  delete[] program;
    119108}
     
    190179  if (infologLength > 0)
    191180  {
    192     infoLog = (char *)malloc(infologLength);
     181    infoLog = (char *)malloc(sizeof(char) * (infologLength+1));
    193182    glGetInfoLogARB(program, infologLength, &charsWritten, infoLog);
    194     printf("%s\n",infoLog);
     183    printf("%s\n", infoLog);
    195184    free(infoLog);
    196185  }
Note: See TracChangeset for help on using the changeset viewer.