Why do I need to glFlush?

Nibbie
Posts: 4
Joined: 2009.10
Post: #1
Hello everyone on the forum, first time poster so please be gentle. Grin

I'm having a problem with my home project OpenGL game I'm working on.

For some reason I have to do a glFlush() or the game screen won't display. The stuff I've read seems to say I don't need to and in fact shouldn't as the program will hang about for ages syncing with OGL. Which is what it does.

The code I've written works on OS X and WINDERS (on which I don't need to do a flush) and the majority is platform independent.

I've zipped up my OS X specfic code which you can see here. I do the flush on line 101 in NSOpenGLView.mm You can find the file here:

http://www.blockcopycoders.com/temp/mac.zip

Any help very gratefully received, it'd be nice to get the time back the glFlush is consuming Grin

gaz
Quote this message in a reply
Nibbie
Posts: 4
Joined: 2009.10
Post: #2
Hello!

I just wanted to post again to say I'm an idiot Grin

I hadn't set the NSOpenGLView to be double buffered in the NIB

I've done that and it all works nicely now Smile

Sorry for the time waste Wink

gaz
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #3
Are you using single buffering by accident? When using double buffering you rarely ever need to call glFlush(). As you've found, the common wisdom is that if you do need to call flush then you are probably doing something wrong.

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
Nibbie
Posts: 4
Joined: 2009.10
Post: #4
Cheers man Smile

I did spot my error prior to your helpful reply and post here about but being a n00b my post had to be okayed by a moderator so its only just appeared.

Shark not reporting any time lost in glFlush now so I'm a happy camper Smile

gaz
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  about getting rid of glFlush() ylaporte 11 5,672 Nov 4, 2002 10:59 AM
Last Post: Feanor