Problem with fullscreen OpenGL on the Mac
Now I am porting s开发者_运维知识库ome 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
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.
精彩评论