mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -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
|
// Function: GLGraphicsStateGuardian::get_error_string
|
||||||
// Access: Protected, Static
|
// Access: Protected, Static
|
||||||
// Description: Returns gluGetErrorString(), if GLU is available;
|
// Description: Returns an error string for an OpenGL error code.
|
||||||
// otherwise, returns some default error message.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
string CLP(GraphicsStateGuardian)::
|
string CLP(GraphicsStateGuardian)::
|
||||||
get_error_string(GLenum error_code) {
|
get_error_string(GLenum error_code) {
|
||||||
@ -5181,6 +5180,27 @@ get_error_string(GLenum error_code) {
|
|||||||
}
|
}
|
||||||
#endif // HAVE_GLU
|
#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;
|
ostringstream strm;
|
||||||
strm << "GL error " << (int)error_code;
|
strm << "GL error " << (int)error_code;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user