3 #include "breakpoint.h"
9 static int in_begin_block = 0;
10 static GLenum cur_error = GL_NO_ERROR;
12 static void check_error()
14 static GLenum (*orig_glGetError)() = NULL;
21 orig_glGetError = glsym("glGetError");
23 code = orig_glGetError();
28 pkt = packet_begin(FUNC_GLDERROR);
29 packet_write_int(pkt, code);
30 packet_send(pkt, get_out_fd());
32 if(cur_error==GL_NO_ERROR)
37 void APIENTRY glBegin(GLenum mode)
39 static void (*orig)(GLenum) = NULL;
43 orig = glsym("glBegin");
46 pkt = packet_begin(FUNC_GLBEGIN);
47 packet_write_int(pkt, mode);
48 packet_send(pkt, get_out_fd());
55 static void (*orig)() = NULL;
59 orig = glsym("glEnd");
62 pkt = packet_begin(FUNC_GLEND);
63 packet_send(pkt, get_out_fd());
69 GLenum APIENTRY glGetError()
71 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 pkt = packet_begin(FUNC_GLGETERROR);
86 packet_write_int(pkt, ret);
87 packet_send(pkt, get_out_fd());
92 void (*glXGetProcAddress(const GLubyte *procname))(void)
98 if(glsym((const char *)procname))
100 handle = dlopen(NULL, RTLD_LAZY);
101 ret = dlsym(handle, (const char *)procname);
104 pkt = packet_begin(FUNC_GLXGETPROCADDRESS);
105 packet_write_string(pkt, (const char *)procname);
106 packet_write_pointer(pkt, ret);
107 packet_send(pkt, get_out_fd());
112 void (*glXGetProcAddressARB(const GLubyte *))(void) __attribute__((alias("glXGetProcAddress")));
114 #include "gensrc/glwrap.funcs"