]> git.tdb.fi Git - gldbg.git/blobdiff - source/glwrap_funcs.c
Add a flavor system to allow addition of other OpenGL versions
[gldbg.git] / source / glwrap_funcs.c
diff --git a/source/glwrap_funcs.c b/source/glwrap_funcs.c
deleted file mode 100644 (file)
index b6bc4d8..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $Id$
-
-This file is part of gldbg
-Copyright © 2010  Mikko Rasa, Mikkosoft Productions
-Distributed under the GPL
-*/
-
-#include <dlfcn.h>
-#include <X11/Xlib.h>
-#include <GL/gl.h>
-#include <GL/glx.h>
-#include "arraysize.h"
-#include "functions.h"
-#include "glwrap.h"
-
-int in_begin_block = 0;
-GLenum cur_error = GL_NO_ERROR;
-
-static void check_error()
-{
-       GLenum (*orig_glGetError)() = 0;
-       GLenum code;
-
-       if(in_begin_block)
-               return;
-
-       if(!orig_glGetError)
-               orig_glGetError = glsym("glGetError");
-
-       code = orig_glGetError();
-       if(code!=GL_NO_ERROR)
-       {
-               begin_packet(FUNC_GLDERROR);
-               write_int(code);
-               send_packet();
-
-               if(cur_error==GL_NO_ERROR)
-                       cur_error = code;
-       }
-}
-
-void APIENTRY glBegin(GLenum mode)
-{
-       static void (*orig)(GLenum);
-       if(!orig)
-               orig = glsym("glBegin");
-       orig(mode);
-
-       begin_packet(FUNC_GLBEGIN);
-       write_int(mode);
-       send_packet();
-
-       in_begin_block = 1;
-}
-
-void APIENTRY glEnd()
-{
-       static void (*orig)();
-       if(!orig)
-               orig = glsym("glEnd");
-       orig();
-
-       begin_packet(FUNC_GLEND);
-       send_packet();
-
-       in_begin_block = 0;
-       check_error();
-}
-
-GLenum APIENTRY glGetError()
-{
-       GLenum ret = GL_NO_ERROR;
-
-       if(in_begin_block)
-       {
-               if(cur_error==GL_NO_ERROR)
-                       cur_error = GL_INVALID_OPERATION;
-       }
-       else
-       {
-               ret = cur_error;
-               cur_error = GL_NO_ERROR;
-       }
-
-       begin_packet(FUNC_GLGETERROR);
-       write_int(ret);
-       send_packet();
-
-       return ret;
-}
-
-void (*glXGetProcAddress(const GLubyte *procname))(void)
-{
-       void *handle = 0;
-       void (*ret)() = 0;
-
-       if(glsym((const char *)procname))
-       {
-               handle = dlopen(NULL, RTLD_LAZY);
-               ret = dlsym(handle, (const char *)procname);
-       }
-
-       begin_packet(FUNC_GLXGETPROCADDRESS);
-       write_string((const char *)procname);
-       write_pointer(ret);
-       send_packet();
-
-       return ret;
-}
-
-void (*glXGetProcAddressARB(const GLubyte *))(void) __attribute__((alias("glXGetProcAddress")));
-
-#include "gensrc/glwrap.funcs"