Jump to content
  • Advertisement
Sign in to follow this  

OpenGL NSOpenGLPixelFormatAttribute and a NSOpenGLView Derived class

This topic is 3280 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!