Full screen crashes?

I got Lesson01_OSXCocoa from nehe…
I got it to work, but when I switch to full screen it crashes.
Anybody else have this problem?

G5 MAC OS X.

The full-screen switching code in the Cocoa ports of the NeHe tutorials is very broken. I know for a fact that it doesn’t work on some hardware; that it crashes for you doesn’t surprise me.

As an apple employee and spy we expect a better answer than that, “Cookie”.

The problem with that code (Bryan Blackburn’s port of NeHe lesson 01) is that it does not specify the display to use in the fullscreen pixel format. It might have worked four years ago, but on any PowerBook or recent Mac, you’ve got multiple display connectors. You must specify which display you want the GL context to use, even if you don’t have a second display currently connected.

So, in Lesson01View.m, createPixelFormat:, change this code:

   if( runningFullScreen )  // Do this before getting the pixel format
   {
      pixelAttribs[ pixNum++ ] = NSOpenGLPFAFullScreen;
      ...

to this:

   if( runningFullScreen )  // Do this before getting the pixel format
   {
      pixelAttribs[ pixNum++ ] = NSOpenGLPFAFullScreen;
      pixelAttribs[ pixNum++ ] = NSOpenGLPFAScreenMask;
      pixelAttribs[ pixNum++ ] = CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay);
      ...

That fixes the fullscreen error for me. It assumes you want to use the primary display; you can pass the proper ID if you want to run on a different display.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.