]> git.notmuchmail.org Git - glfps/commitdiff
Add wrapper for glXGetProcAddressARB
authorCarl Worth <cworth@cworth.org>
Fri, 20 Sep 2013 23:39:17 +0000 (16:39 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 23 Sep 2013 14:11:10 +0000 (07:11 -0700)
Some applications may be using this to get at the functions we want to
wrap, so we have to wrap it as well.

glfps.c

diff --git a/glfps.c b/glfps.c
index 68d389a75d2cb10e71b1d9c7548d0160d941073a..e6739e4fad279588459ba6723dffb8119a58ef02 100644 (file)
--- a/glfps.c
+++ b/glfps.c
@@ -8,6 +8,7 @@
 #include <GL/glx.h>
 
 #include <sys/time.h>
+#include <string.h>
 
 /* How many frames between reports. */
 #define REPORT_FREQ 60
@@ -46,3 +47,17 @@ glXSwapBuffers (Display *dpy, GLXDrawable drawable)
 
        real_glXSwapBuffers (dpy, drawable);
 }
+
+void
+(*glXGetProcAddressARB (const GLubyte *func))(void)
+{
+       static typeof(&glXGetProcAddressARB) real_glXGetProcAddressARB = NULL;
+
+       if (strcmp((char *) func, "glXSwapBuffers") == 0)
+               return (void*) glXSwapBuffers;
+
+       if (real_glXGetProcAddressARB == NULL)
+               real_glXGetProcAddressARB = dlsym (RTLD_NEXT, "glXGetProcAddressARB");
+
+       return real_glXGetProcAddressARB (func);
+}