separate nolok sprite
[supertux.git] / src / video / glutil.hpp
index f7d4310..fb55084 100644 (file)
@@ -22,7 +22,6 @@
 #include <sstream>
 #include <stdexcept>
 #include <GL/gl.h>
-#include <GL/glu.h>
 
 static inline void assert_gl(const char* message)
 {
@@ -30,8 +29,37 @@ static inline void assert_gl(const char* message)
   GLenum error = glGetError();
   if(error != GL_NO_ERROR) {
     std::ostringstream msg;
-    msg << "OpenGLError while '" << message << "': "
-        << gluErrorString(error);
+    msg << "OpenGLError while '" << message << "': ";
+    switch(error) {
+      case GL_INVALID_ENUM:
+        msg << "INVALID_ENUM: An unacceptable value is specified for an "
+               "enumerated argument.";
+        break;
+      case GL_INVALID_VALUE:
+        msg << "INVALID_VALUE: A numeric argument is out of range.";
+        break;
+      case GL_INVALID_OPERATION:
+        msg << "INVALID_OPERATION: The specified operation is not allowed "
+               "in the current state.";
+        break;
+      case GL_STACK_OVERFLOW:
+        msg << "STACK_OVERFLOW: This command would cause a stack overflow.";
+        break;
+      case GL_STACK_UNDERFLOW:
+        msg << "STACK_UNDERFLOW: This command would cause a stack underflow.";
+        break;
+      case GL_OUT_OF_MEMORY:
+        msg << "OUT_OF_MEMORY: There is not enough memory left to execute the "
+               "command.";
+        break;
+      case GL_TABLE_TOO_LARGE:
+        msg << "TABLE_TOO_LARGE: The specified table exceeds the "
+               "implementation's maximum supported table size.";
+        break;
+      default:
+        msg << "Unknown error (code " << error << ")";
+    }
+        
     throw std::runtime_error(msg.str());
   }
 #endif