OpenGL view first frame flickers garbage

Member
Posts: 30
Joined: 2010.08
Post: #1
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.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #2
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.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 30
Joined: 2010.08
Post: #3
What do you mean the framebuffer? How can I stop it from displaying?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #4
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.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 30
Joined: 2010.08
Post: #5
Am I able to control that If it's created in the nib?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #6
You control when the window appears on the screen.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 30
Joined: 2010.08
Post: #7
From where? The nib creates it and displays it automatically.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #8
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.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 30
Joined: 2010.08
Post: #9
Should I draw the first frame and then make the window visible in awakeFromNib, applicationWillFinishLaunching: or applicationDidFinishLaunching: (of the Application Delegate)?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  When to create custom OpenGL view instead of subclass NSOpenGL view Coyote 37 21,429 Oct 20, 2009 08:16 PM
Last Post: Coyote
  OpenGL & Cocoa - Improving frame rate daveh84 4 5,411 Feb 2, 2009 06:53 AM
Last Post: backslash
  OpenGL full screen mode leaves garbage on screen when exiting app Malarkey 5 5,091 Nov 19, 2008 12:51 PM
Last Post: Malarkey
  opengl view question Leroy 3 3,203 Jul 23, 2007 11:08 PM
Last Post: AnotherJake
  Porting SDL to Cocoa OpenGL view--texture problem smittyz 7 4,997 Jul 21, 2007 07:53 PM
Last Post: smittyz