views:

394

answers:

1

Hi, programmers!

Now I am porting some OpenGL tutorials from win/glut to cocoa/mac os x. In the windowed mode everything works, but when context switches to fullscreen, screen may be empty (only clear colour)! For example: in the first, second, third times cube is, but in the fourth time cube is not. Even if app launches in fullscreen without sharing context. I don`t understand.

Xcode 3.2.1, Mac OS X 10.6.2

source link

+1  A: 

It looks like AFController's enterFullScreen method probably needs to set up the OpenGL context ([scene initGL]).

Also, awakeFromNib may be called before the application is ready to draw, so perhaps it's not the best place for [scene initGL]. I suggest implementing NSApplication's delegate method, applicationDidFinishLaunching:, and moving [scene initGL] there. Just to be safe, you might also try calling NSOpenGLContext's makeCurrentContext from there as well.

tedge
I fixed bits of code that you said, but nothing changes. I test app under both 10.6 and 10.5
Ariel