]> git.cworth.org Git - apitrace/blobdiff - glproc.py
Trace the whole OpenGL framework on Mac OS X.
[apitrace] / glproc.py
index 067017b7f9bdf9a89deb327ec21fde385fed48d8..64ea360eb34ba5e27c76ff08faa26923b99448f9 100644 (file)
--- a/glproc.py
+++ b/glproc.py
@@ -411,8 +411,11 @@ class GlDispatcher(Dispatcher):
 
     def header(self):
         print '#ifdef RETRACE'
-        print '#  ifdef _WIN32'
+        print '#  if defined(_WIN32)'
         print '#    define __getPrivateProcAddress(name) wglGetProcAddress(name)'
+        print '#  elif defined(__APPLE__)'
+        print '#    include <dlfcn.h>'
+        print '#    define __getPrivateProcAddress(name) dlsym(RTLD_DEFAULT, name)'
         print '#  else'
         print '#    define __getPrivateProcAddress(name) glXGetProcAddressARB((const GLubyte *)(name))'
         print '#  endif'
@@ -436,7 +439,7 @@ class GlDispatcher(Dispatcher):
         print
         
     def is_public_function(self, function):
-        return function.name in public_symbols
+        return function.name in public_symbols or function.name.startswith('CGL')
 
 
 if __name__ == '__main__':
@@ -450,17 +453,15 @@ if __name__ == '__main__':
     print
     dispatcher = GlDispatcher()
     dispatcher.header()
-    print '#ifdef _WIN32'
+    print '#if defined(_WIN32)'
     print
     dispatcher.dispatch_api(wglapi)
-    print '#else /* !_WIN32 */'
+    print '#elif defined(__APPLE__)'
+    dispatcher.dispatch_api(cglapi)
+    print '#else'
     print
     dispatcher.dispatch_api(glxapi)
-    print '#endif /* !_WIN32 */'
-    print
-    print '#ifdef __APPLE__'
-    dispatcher.dispatch_api(cglapi)
-    print '#endif /* __APPLE__ */'
+    print '#endif'
     print
     dispatcher.dispatch_api(glapi)
     print