MCPcopy Create free account
hub / github.com/TankOs/SFGUI / DoCheckGLError

Function DoCheckGLError

src/SFGUI/GLCheck.cpp:7–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <iomanip>
6
7void DoCheckGLError( const char* file, unsigned int line, const char* call ) {
8 // Flag to control whether an external debug tool is being used
9 static const auto external_gl_debug = false;
10
11 if( external_gl_debug ) {
12 return;
13 }
14
15 auto error = glGetError();
16
17 if( error != GL_NO_ERROR ) {
18 std::cerr << "GL Error detected at " << file << ":L" << std::dec << line << std::endl;
19 std::cerr << call << std::endl;
20 std::cerr << "Error: ";
21
22 switch( error ) {
23 case GL_INVALID_ENUM:
24 std::cerr << "GL_INVALID_ENUM";
25 break;
26 case GL_INVALID_VALUE:
27 std::cerr << "GL_INVALID_VALUE";
28 break;
29 case GL_INVALID_OPERATION:
30 std::cerr << "GL_INVALID_OPERATION";
31 break;
32 case GL_OUT_OF_MEMORY:
33 std::cerr << "GL_OUT_OF_MEMORY";
34 break;
35 default:
36 std::cerr << "0x" << std::setw( 4 ) << std::setfill( '0' ) << std::hex << error;
37 break;
38 }
39
40 std::cerr << std::endl << std::endl;
41 }
42}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected