X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fglws_cocoa.mm;h=3dcbc0a1b135b87676ed6094146165ab09585bd9;hb=8ab3aa7e2191fb30d168ea02d38e5b1acc0877f4;hp=7f696fa0f36b9b0f8c48a4f822bc6df930f9f1f0;hpb=9d27a54b0381610c30964880a5fdd4c27bb6e732;p=apitrace diff --git a/retrace/glws_cocoa.mm b/retrace/glws_cocoa.mm index 7f696fa..3dcbc0a 100644 --- a/retrace/glws_cocoa.mm +++ b/retrace/glws_cocoa.mm @@ -36,9 +36,13 @@ */ +#include "glproc.hpp" + #include #include +#include + #include #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(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]; @@ -193,6 +200,12 @@ createVisual(bool doubleBuffer, Profile profile) { return NULL; #endif } + + // Use Apple software rendering for debugging purposes. + if (0) { + attribs.add(NSOpenGLPFARendererID, 0x00020200); // kCGLRendererGenericID + } + attribs.end(); NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] @@ -202,13 +215,13 @@ 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 * -createContext(const Visual *visual, Context *shareContext, Profile profile) +createContext(const Visual *visual, Context *shareContext, Profile profile, bool debug) { NSOpenGLPixelFormat *pixelFormat = static_cast(visual)->pixelFormat; NSOpenGLContext *share_context = nil;