3 This file is part of gldbg
4 Copyright © 2010 Mikko Rasa, Mikkosoft Productions
5 Distributed under the GPL
10 #include "functions.h"
14 int in_begin_block = 0;
15 GLenum cur_error = GL_NO_ERROR;
17 static void check_error()
19 GLenum (*orig_glGetError)() = 0;
26 orig_glGetError = glsym("glGetError");
28 code = orig_glGetError();
31 begin_packet(FUNC_GLDERROR);
35 if(cur_error==GL_NO_ERROR)
40 void APIENTRY glBegin(GLenum mode)
42 static void (*orig)(GLenum);
44 orig = glsym("glBegin");
47 begin_packet(FUNC_GLBEGIN);
56 static void (*orig)();
58 orig = glsym("glEnd");
61 begin_packet(FUNC_GLEND);
68 GLenum APIENTRY glGetError()
70 GLenum ret = GL_NO_ERROR;
74 if(cur_error==GL_NO_ERROR)
75 cur_error = GL_INVALID_OPERATION;
80 cur_error = GL_NO_ERROR;
83 begin_packet(FUNC_GLGETERROR);
90 void (*glXGetProcAddress(const GLubyte *procname))(void)
95 if(glsym((const char *)procname))
97 handle = dlopen(NULL, RTLD_LAZY);
98 ret = dlsym(handle, (const char *)procname);
101 begin_packet(FUNC_GLXGETPROCADDRESS);
102 write_string((const char *)procname);
109 void (*glXGetProcAddressARB(const GLubyte *))(void) __attribute__((alias("glXGetProcAddress")));
111 #include "gensrc/glwrap.funcs"