Search
lxdream.org :: lxdream/src/pvr2/glutil.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/glutil.c
changeset 1150:1038800cecd8
prev1140:7dc1c71ece76
next1159:580436b01b6c
author nkeynes
date Thu Nov 11 17:51:37 2010 +1000 (10 years ago)
permissions -rw-r--r--
last change Add convenience gl_check_error() function
file annotate diff log raw
1.1 --- a/src/pvr2/glutil.c Tue Oct 26 08:39:02 2010 +1000
1.2 +++ b/src/pvr2/glutil.c Thu Nov 11 17:51:37 2010 +1000
1.3 @@ -167,3 +167,27 @@
1.4 display_driver->print_info(out);
1.5 }
1.6 }
1.7 +
1.8 +gboolean gl_check_error(const char *context)
1.9 +{
1.10 + GLint err = glGetError();
1.11 + if( err != 0 ) {
1.12 + const char *s;
1.13 + switch( err ) {
1.14 + case GL_INVALID_ENUM: s = "Invalid enum"; break;
1.15 + case GL_INVALID_VALUE: s = "Invalid value"; break;
1.16 + case GL_INVALID_OPERATION: s = "Invalid operation"; break;
1.17 + case GL_STACK_OVERFLOW: s = "Stack overflow"; break;
1.18 + case GL_STACK_UNDERFLOW: s = "Stack underflow"; break;
1.19 + case GL_OUT_OF_MEMORY: s = "Out of memory"; break;
1.20 + default: s = "Unknown error"; break;
1.21 + }
1.22 + if( context ) {
1.23 + WARN( "%s: GL error: %x (%s)\n", context, err, s );
1.24 + } else {
1.25 + WARN( "GL error: %x (%s)\n", err, s );
1.26 + }
1.27 + return TRUE;
1.28 + }
1.29 + return FALSE;
1.30 +}
.