]> git.cworth.org Git - fips/blobdiff - glwrap.h
Add two missing GL draw wrappers
[fips] / glwrap.h
index 81e1e34c9f0ccc11980de3e70caf42366dd501c2..9195007c4b51b15cd8eb38eea9439ee0c15d4579 100644 (file)
--- a/glwrap.h
+++ b/glwrap.h
 #ifndef GLWRAP_H
 #define GLWRAP_H
 
-/* Should be called at the end of ever function wrapper for an OpenGL
- * function that ends a frame, (glXSwapBuffers and similar).
+/* Lookup a function named 'name' in the underlying, real, libGL.so */
+void *
+glwrap_lookup (char *name);
+
+/* Defer to the real 'function' (from libGL.so) to do the real work.
+ * The symbol is looked up once and cached in a static variable for
+ * future uses.
  */
-void
-glwrap_end_frame (void);
+#define GLWRAP_DEFER(function,...) do {                                \
+       static typeof(&function) real_ ## function;             \
+       if (! real_ ## function)                                \
+               real_ ## function = glwrap_lookup (#function);  \
+       real_ ## function(__VA_ARGS__);                         \
+} while (0);
 
 #endif