3 This file is part of gldbg
4 Copyright © 2010 Mikko Rasa, Mikkosoft Productions
5 Distributed under the GPL
12 #include "arraysize.h"
13 #include "functions.h"
16 int in_begin_block = 0;
17 GLenum cur_error = GL_NO_ERROR;
19 static void check_error()
21 GLenum (*orig_glGetError)() = 0;
28 orig_glGetError = glsym("glGetError");
30 code = orig_glGetError();
33 begin_packet(FUNC_GLDERROR);
37 if(cur_error==GL_NO_ERROR)
42 void APIENTRY glBegin(GLenum mode)
44 static void (*orig)(GLenum);
46 orig = glsym("glBegin");
49 begin_packet(FUNC_GLBEGIN);
58 static void (*orig)();
60 orig = glsym("glEnd");
63 begin_packet(FUNC_GLEND);
70 GLenum APIENTRY glGetError()
72 GLenum ret = GL_NO_ERROR;
76 if(cur_error==GL_NO_ERROR)
77 cur_error = GL_INVALID_OPERATION;
82 cur_error = GL_NO_ERROR;
85 begin_packet(FUNC_GLGETERROR);
92 void (*glXGetProcAddress(const GLubyte *procname))(void)
97 if(glsym((const char *)procname))
99 handle = dlopen(NULL, RTLD_LAZY);
100 ret = dlsym(handle, (const char *)procname);
103 begin_packet(FUNC_GLXGETPROCADDRESS);
105 write_string((const char *)procname);
111 void (*glXGetProcAddressARB(const GLubyte *))(void) __attribute__((alias("glXGetProcAddress")));
113 #include "gensrc/glwrap.funcs"