mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
Fallback case for get_error_string in case we're not building with GLU
This commit is contained in:
parent
a6e6303bef
commit
34f39259ca
@ -5169,8 +5169,7 @@ report_errors_loop(int line, const char *source_file, GLenum error_code,
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GLGraphicsStateGuardian::get_error_string
|
||||
// Access: Protected, Static
|
||||
// Description: Returns gluGetErrorString(), if GLU is available;
|
||||
// otherwise, returns some default error message.
|
||||
// Description: Returns an error string for an OpenGL error code.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
string CLP(GraphicsStateGuardian)::
|
||||
get_error_string(GLenum error_code) {
|
||||
@ -5181,6 +5180,27 @@ get_error_string(GLenum error_code) {
|
||||
}
|
||||
#endif // HAVE_GLU
|
||||
|
||||
// The idea with the error table was taken from SGI's sample implementation.
|
||||
static const char *error_strings[GL_OUT_OF_MEMORY - GL_INVALID_ENUM + 1] = {
|
||||
"invalid enumerant",
|
||||
"invalid value",
|
||||
"invalid operation",
|
||||
"stack overflow",
|
||||
"stack underflow",
|
||||
"out of memory",
|
||||
};
|
||||
|
||||
if (error_code == GL_NO_ERROR) {
|
||||
return "no error";
|
||||
#ifndef OPENGLES
|
||||
} else if (error_code == GL_TABLE_TOO_LARGE) {
|
||||
return "table too large";
|
||||
#endif
|
||||
} else if (error_code >= GL_INVALID_ENUM && error_code <= GL_OUT_OF_MEMORY) {
|
||||
return error_strings[error_code - GL_INVALID_ENUM];
|
||||
}
|
||||
|
||||
// Other error, somehow? Just display the error code then.
|
||||
ostringstream strm;
|
||||
strm << "GL error " << (int)error_code;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user