mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-18 23:10:26 +00:00
GLWRAP for debugging GL errors
This commit is contained in:
parent
b3db152ee6
commit
4373c03823
18
glhr.cpp
18
glhr.cpp
@ -59,6 +59,24 @@ EX void glError(const char* GLcall, const char* file, const int line) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HDR
|
||||||
|
struct glwrap {
|
||||||
|
const char* msg;
|
||||||
|
int line;
|
||||||
|
void act(const char *when);
|
||||||
|
glwrap(const char *m, int l) : msg(m), line(l) { act("before"); }
|
||||||
|
~glwrap() { act("after"); }
|
||||||
|
};
|
||||||
|
#define GLWRAP glwrap w##__line(__FILE__, __LINE__)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void glwrap::act(const char *when) {
|
||||||
|
GLenum errCode = glGetError();
|
||||||
|
if(errCode!=GL_NO_ERROR) {
|
||||||
|
println(hlog, format("GL error %i %s: %s:%i", errCode, when, msg, line));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if HDR
|
#if HDR
|
||||||
#if CAP_SHADER && CAP_NOSHADER
|
#if CAP_SHADER && CAP_NOSHADER
|
||||||
#define WITHSHADER(x, y) if(glhr::noshaders) y else x
|
#define WITHSHADER(x, y) if(glhr::noshaders) y else x
|
||||||
|
Loading…
Reference in New Issue
Block a user