]> git.cworth.org Git - apitrace/blobdiff - retrace/glws_cocoa.mm
Ignore OpenGL core 3.2 requirement on Windows.
[apitrace] / retrace / glws_cocoa.mm
index 245ea4fb9673cd2b9078c5a47ab165007e98d4d4..3dcbc0a1b135b87676ed6094146165ab09585bd9 100644 (file)
  */
 
 
+#include "glproc.hpp"
+
 #include <stdlib.h>
 #include <iostream>
 
+#include <dlfcn.h>
+
 #include <Cocoa/Cocoa.h>
 
 #include "glws.hpp"
@@ -71,8 +75,8 @@ public:
     NSWindow *window;
     NSOpenGLContext *currentContext;
 
-    CocoaDrawable(const Visual *vis, int w, int h) :
-        Drawable(vis, w, h),
+    CocoaDrawable(const Visual *vis, int w, int h, bool pbuffer) :
+        Drawable(vis, w, h, pbuffer),
         currentContext(nil)
     {
         NSOpenGLPixelFormat *pixelFormat = static_cast<const CocoaVisual *>(visual)->pixelFormat;
@@ -156,6 +160,9 @@ public:
 
 void
 init(void) {
+    // Prevent glproc to load system's OpenGL, so that we can trace glretrace.
+    _libGlHandle = dlopen("OpenGL", RTLD_LOCAL | RTLD_NOW | RTLD_FIRST);
+
     [NSApplication sharedApplication];
 
     autoreleasePool = [[NSAutoreleasePool alloc] init];
@@ -208,9 +215,9 @@ createVisual(bool doubleBuffer, Profile profile) {
 }
 
 Drawable *
-createDrawable(const Visual *visual, int width, int height)
+createDrawable(const Visual *visual, int width, int height, bool pbuffer)
 {
-    return new CocoaDrawable(visual, width, height);
+    return new CocoaDrawable(visual, width, height, pbuffer);
 }
 
 Context *