NSOpenGLPixelFormatAttribute and a NSOpenGLView Derived class

Started by
-1 comments, last by Mathucub 14 years, 3 months ago
Hello All, Just spent a few hours debugging and thought I'd share the wealth. I've got an engine that runs on both windows and osx, so I'm hitting all sorts of little knowledge bits about defaults on both. Trick I found today, even when you create the window with attributes: // Pixel Format Attributes for the FullScreen NSOpenGLContext NSOpenGLPixelFormatAttribute attrs[] = { // Specifying "NoRecovery" gives us a context that cannot fall back to the software renderer. This makes the View-based context a compatible with the fullscreen context, enabling us to use the "shareContext" feature to share textures, display lists, and other OpenGL objects between the two. NSOpenGLPFANoRecovery, // Specify that we want a full-screen OpenGL context. NSOpenGLPFAFullScreen, // We may be on a multi-display system (and each screen may be driven by a different renderer), so we need to specify which screen we want to take over. For this demo, we'll specify the main screen. NSOpenGLPFAScreenMask, CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay), // Attributes Common to FullScreen and non-FullScreen NSOpenGLPFAColorSize, 32, NSOpenGLPFADepthSize, 16, NSOpenGLPFADoubleBuffer, NSOpenGLPFAAccelerated, 0 }; Which tells it to make a 16bit depth buffer--YOU HAVE TO USE INTERFACEBUILDER TO SET THE VIEW SETTINGS. These only seem to stick if you actually force it to init full screen. Also be careful about keeping the settings of this structure in sync with those of view in interface builder, otherwise you just get a white rect. instead of a gl view.

This topic is closed to new replies.

Advertisement