Game Development Community

Simple Error Checking Routine For OpenGL

by Demolishun · in Torque Game Engine · 01/27/2007 (6:19 pm) · 0 replies

This isn't really exciting and it did not find my problem, but I thought I would share. Feel free to add additional error codes:
GLenum glError = glGetError();
   if(GL_NO_ERROR != glError)
   {
      //Con::printf("glError:%d",glError);
      //Con::printf("gl Version:%s",glGetString(GL_VERSION));
      if(glError == GL_INVALID_ENUM)
         Con::printf("GL_INVALID_ENUM");
      else if(glError == GL_INVALID_VALUE)
         Con::printf("GL_INVALID_VALUE");
      else if(glError == GL_INVALID_OPERATION)
         Con::printf("GL_INVALID_OPERATION");      
      else
         Con::printf("GL_?_ERROR: %d",glError);
   }

Also, glu has a similar function, but Torque did not take kindly to trying to link it in.

About the author

I love programming, I love programming things that go click, whirr, boom. For organized T3D Links visit: http://demolishun.com/?page_id=67