Go to the documentation of this file.00001 #ifndef OPENTISSUE_UTILITY_GL_GL_CHECK_ERRORS_H
00002 #define OPENTISSUE_UTILITY_GL_GL_CHECK_ERRORS_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/utility/gl/gl.h>
00013 #include<iostream>
00014
00015 namespace OpenTissue
00016 {
00017
00018 namespace gl
00019 {
00020
00030 #ifndef NDEBUG
00031 inline void gl_check_errors( const char* location = 0, std::ostream& ostr = std::cerr )
00032 {
00033 GLuint errnum;
00034 const char *errstr;
00035 while ( (errnum = glGetError()) != 0 )
00036 {
00037 errstr = reinterpret_cast<const char *>(gluErrorString(errnum));
00038 if (errstr)
00039 ostr << errstr;
00040 else
00041 ostr << "<unknown err: " << errnum << ">";
00042
00043 if(location)
00044 ostr << " at " << location;
00045 ostr << std::endl;
00046 }
00047 return;
00048 }
00049 #else
00050 inline void gl_check_errors( )
00051 {}
00052 inline void gl_check_errors( const char* )
00053 {}
00054 inline void gl_check_errors( const char* , std::ostream& )
00055 {}
00056 #endif
00057
00058 }
00059
00060 }
00061
00062
00063 #endif