Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5267 in orxonox.OLD for trunk/src/lib/graphics


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

orxonox/trunk: nicer error-checking

File:
1 edited

Legend:

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

    r5266 r5267  
    6565  this->deleteProgram(SHADER_FRAGMENT);
    6666
     67  glDeleteObjectARB(this->fragmentShader);
     68  glDeleteObjectARB(this->vertexShader);
    6769  glDeleteObjectARB(this->shaderProgram);
    6870}
     
    167169void Shader::printError(GLenum program)
    168170{
    169   GLint length = 5000;
    170 //  glGetObjectParameterARBfiv(program, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length);
    171   char* text = new char[length+1];
    172   glGetInfoLogARB(program, length, &length, text);
    173   printf("%s\n", text);
    174   delete[] text;
     171  int infologLength = 0;
     172  int charsWritten  = 0;
     173  char *infoLog;
     174
     175  glGetObjectParameterivARB(program, GL_OBJECT_INFO_LOG_LENGTH_ARB,
     176                            &infologLength);
     177
     178  if (infologLength > 0)
     179  {
     180    infoLog = (char *)malloc(infologLength);
     181    glGetInfoLogARB(program, infologLength, &charsWritten, infoLog);
     182    printf("%s\n",infoLog);
     183    free(infoLog);
     184  }
    175185}
    176186
Note: See TracChangeset for help on using the changeset viewer.