Full-screen with NSOpenGLView not working

I posted a help on macosxdev at Omnigroup about my problem but so far haven't received any help. One person also had this problem and suggests just using CGDirectDisplay for the whole procress. Unless NSOpenGLView is not meant to work with full-screen (but there IS a setFullScreen method, and some documentation about it in the OpenGL section of programming topics at Apple's developer site), I'd like to go with NSOpenGLView.

NSOpenGLView isn't for full screen. If you're looking for fullscreen OpenGL, then what you should do is just use NSOpenGLContext alone and forget the whole Window/View structure. After calling setFullScreen and makeCurrentContext, any OpenGL calls go to that context, whether there's a view or not.

Thanks for the example!
The full-screen mode doesn't work as expected though, does it for others?
Maybe it's just the screen positioning problem with my monitor... but I don't have that problem with other programs in 800x600 resolution. Graphics are drawn just fine though.

Anyway, I used bits of code from your example, and I also implemented a drawScene method with the gameWorld object. It works great in windowed mode, but with full-screen, just garbage is drawn and flashes everytime drawScene is called. I've been wondering why it wouldn't work for mine, and for your project it works (at least graphics are drawn properly).

Is it posible to just use CGDirectDisplay for full-screen and get the full-screen context wrapped in NSOpenGLContext? Otherwise I'd have to make 2 separate drawing operations for 2 different types of contexts... and no one would want to do that.

I'll examine it more tommorow and try to get graphics drawn properly for my project...

Oh my god... I just tracked down the bug I couldn't figure out for 3 days! I'm so happy.
You could say it's stupid... but I realized that in my code, drawRect was being called AFTER the full-screen context was set up, and after it ENETERED full-screen mode. So I'm assuming drawRect couldn't find it's proper windowed context and messed things up. So I want to enter full-screen mode after drawRect is being called... which means I have to initially draw things on the windowed view. But then if I showed it and entered full-screen right after, my contents would be drawn in the windowed view for just a millisecond and then immediately switch to full-screen, having my contents drawn for the second time. How should I avoid this? Unlike Feanor's example code, I want my app to run full-screen or windowed mode based on preferences, not by user interaction in windowed mode.

Maybe I should separate the class into two, one for windowed (NSOpenGLView) and one for full-screen (NSObject), and have my delegate control the two. Or call orderOut on the window to hide the windowed drawing before entering full-creen. But if there are any other ideas... it's welcome.

If you are using a captured display and a fullscreen context, you can't use NSOpenGLView, as Jeff Binder noted in his post. You don't want to do any fullscreen setup in your view object at all. You would want to do that in a custom object. The view should only manage its own contexts.

In Light Box, the drawable is controlled in a controller object, not the view itself. In the other sample called CocoaFullScreen, the view controls both contexts, because both are used by that view, which gets move back and forth between two windows -- one from the Nib, the other created programmatically. Let me know if this helps clarify things. -- FÎanor

Thanks,
I thought LightBox attempted to set up both windowed and full-screen in the same NSOpenGLView subclass (athough the drawing was done in the game world object), but if that's wrong, that would probably be why my code is not working... attempting to set up two completely different views in the same class.
I learned how to separate the two using multiple Nibs just now, so this will be the way to go for me.. not to mention just to avoid unnecessary confusion.