]> git.cworth.org Git - glfps/blobdiff - glfps.c
Add wrapper for glXGetProcAddressARB
[glfps] / 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);
+}