3 This file is part of gldbg
4 Copyright © 2010 Mikko Rasa, Mikkosoft Productions
5 Distributed under the GPL
10 #include "functions.h"
15 GLenum cur_error = GL_NO_ERROR;
17 static void check_error()
19 GLenum (*orig_glGetError)() = NULL;
23 orig_glGetError = glsym("glGetError");
25 code = orig_glGetError();
30 pkt = packet_begin(FUNC_GLDERROR);
31 packet_write_int(pkt, code);
32 packet_send(pkt, get_out_fd());
34 if(cur_error==GL_NO_ERROR)
39 GLenum APIENTRY glGetError()
41 GLenum ret = cur_error;
42 cur_error = GL_NO_ERROR;
45 pkt = packet_begin(FUNC_GLGETERROR);
46 packet_write_int(pkt, ret);
47 packet_send(pkt, get_out_fd());
52 void (*eglGetProcAddress(const char *procname))(void)
58 if(glsym((const char *)procname))
60 handle = dlopen(NULL, RTLD_LAZY);
61 ret = dlsym(handle, (const char *)procname);
64 pkt = packet_begin(FUNC_EGLGETPROCADDRESS);
65 packet_write_pointer(pkt, ret);
66 packet_write_string(pkt, (const char *)procname);
67 packet_send(pkt, get_out_fd());
72 #include "gensrc/glwrap.funcs"