Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Return error information using glGetError
- *
- * @see http://www.opengl.org/sdk/docs/man/xhtml/glGetError.xml
- * @see http://www.opengl.org/wiki/OpenGL_Error
- */
- inline void GetOpenGLError(std::string debugMessage = "", bool longMessage = false) {
- GLenum error = glGetError();
- if (debugMessage != "") {
- std::cout << "glGetError(): \"" << debugMessage << "\" - ";
- }
- if (error != GL_NO_ERROR) {
- switch (error) {
- case GL_INVALID_ENUM:
- std::cout << "GL_INVALID_ENUM" << (longMessage ? " (0x0500 - Given when an enumeration parameter is not a legal enumeration for that function. This is given only for local problems; if the spec allows the enumeration in certain circumstances, where other parameters or state dictate those circumstances, then GL_INVALID_OPERATION is the result instead.)" : "") << std::endl;
- break;
- case GL_INVALID_VALUE:
- std::cout << "GL_INVALID_VALUE" << (longMessage ? " (0x0501 - Given when a value parameter is not a legal value for that function. This is only given for local problems; if the spec allows the value in certain circumstances, where other parameters or state dictate those circumstances, then GL_INVALID_OPERATION is the result instead.)" : "") << std::endl;
- break;
- case GL_INVALID_OPERATION:
- std::cout << "GL_INVALID_OPERATION" << (longMessage ? " (0x0502 - Given when the set of state for a command is not legal for the parameters given to that command. It is also given for commands where combinations of parameters define what the legal parameters are.)" : "") << std::endl;
- break;
- case GL_STACK_OVERFLOW:
- std::cout << "GL_STACK_OVERFLOW" << (longMessage ? " (0x0503 - Given when a stack pushing operation cannot be done because it would overflow the limit of that stack's size.)" : "") << std::endl;
- break;
- case GL_STACK_UNDERFLOW:
- std::cout << "GL_STACK_UNDERFLOW" << (longMessage ? " (0x0504 - Given when a stack popping operation cannot be done because the stack is already at its lowest point.)" : "") << std::endl;
- break;
- case GL_OUT_OF_MEMORY:
- std::cout << "GL_OUT_OF_MEMORY" << (longMessage ? " (0x0505 - Given when performing an operation that can allocate memory, and the memory cannot be allocated. The results of OpenGL functions that return this error are undefined; it is allowable for partial operations to happen.)" : "") << std::endl;
- break;
- // case GL_INVALID_FRAMEBUFFER_OPERATION:
- // std::cout << "GL_INVALID_FRAMEBUFFER_OPERATION" << (longMessage ? " (0x0506 - Given when doing anything that would attempt to read from or write/render to a framebuffer that is not complete.)" : "") << std::endl;
- // break;
- // case GL_TABLE_TOO_LARGE1:
- // std::cout << "GL_TABLE_TOO_LARGE1" << (longMessage ? " (0x8031 - Part of the ARB_imaging extension.)" : "") << std::endl;
- // break;
- };
- } else if (debugMessage != "") {
- std::cout << "No error." << std::endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement