iDevGames Forums
OpenGL view first frame flickers garbage - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: OpenGL view first frame flickers garbage (/thread-8069.html)



OpenGL view first frame flickers garbage - mk12 - Sep 3, 2010 09:16 PM

In my OpenGL game, the view always shows random garbage immediately upon launching and then starts rendering. How can I prevent this? The view is created in the nib, would it fix this if I did it programmatically? I'm using a custom NSView, not NSOpenGLView.


RE: OpenGL view first frame flickers garbage - Skorche - Sep 4, 2010 10:02 AM

Clear the framebuffer as soon as it's loaded instead of waiting for the first frame to clear it. Or don't display the framebuffer until you've drawn the first frame.


RE: OpenGL view first frame flickers garbage - mk12 - Sep 4, 2010 10:29 AM

What do you mean the framebuffer? How can I stop it from displaying?


RE: OpenGL view first frame flickers garbage - Skorche - Sep 4, 2010 11:16 AM

The framebuffer is the chunk of video memory that you are drawing into. You can stop it from displaying by not showing the window it's in on the screen until you've drawn the first frame.


RE: OpenGL view first frame flickers garbage - mk12 - Sep 4, 2010 12:53 PM

Am I able to control that If it's created in the nib?


RE: OpenGL view first frame flickers garbage - Skorche - Sep 4, 2010 03:30 PM

You control when the window appears on the screen.


RE: OpenGL view first frame flickers garbage - mk12 - Sep 4, 2010 03:39 PM

From where? The nib creates it and displays it automatically.


RE: OpenGL view first frame flickers garbage - Skorche - Sep 4, 2010 05:39 PM

One of the window settings in Interface Builder is "visible when loaded" or something like that. You can uncheck that and then display the window when it's ready. Clearing the framebuffer when you first create it might be easier, but not as nice presentation wise.


RE: OpenGL view first frame flickers garbage - mk12 - Sep 4, 2010 06:06 PM

Should I draw the first frame and then make the window visible in awakeFromNib, applicationWillFinishLaunching: or applicationDidFinishLaunching: (of the Application Delegate)?