Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Silly_con

glFlush and glFinish

This topic is 5551 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
From MSDN:

quote:

The glFlush function forces execution of OpenGL functions in finite time.

The glFinish function blocks until all OpenGL execution is complete.


Share this post


Link to post
Share on other sites
On the language different than the MSDN trash that means:

call glFlush instead of SwapBuffers if you are using single-buffered mode and call glFinish at the end of your rendering function to finish all OpenGL pipeline ops.

The PAIN is coming...this summer!!!In cinemas everywhere.

Share this post


Link to post
Share on other sites
No, you can''t call glFlush instead of SwapBuffers. glFlush doesn''t swap front/back buffers and SwapBuffers doesn''t execute the OpenGL command pipeline.

Share this post


Link to post
Share on other sites
I''ve got another question related to glFinish. In what kind of way does it block? Does it "suspend" the current thread/process until it gets a signal to continue, or does it poll the pipeline until its execution is complete? I mean in the first way the os could give some cpu time to another thread/process or make the cpu sleep for some time if none is waiting.

eloso

Share this post


Link to post
Share on other sites
quote:
Original post by eloso
I''ve got another question related to glFinish. In what kind of way does it block? Does it "suspend" the current thread/process until it gets a signal to continue, or does it poll the pipeline until its execution is complete? I mean in the first way the os could give some cpu time to another thread/process or make the cpu sleep for some time if none is waiting.

eloso


Nope.The only thing that glFinish do is not to return from the function exucusion while all of the pipeline commands aren''t finished.When they are,the function returns.

The PAIN is coming...this summer!!!In cinemas everywhere.

Share this post


Link to post
Share on other sites
But when it does not return it must do something. Either go to sleep and wait for a signal/interrupt/whatever or go into a loop that polls the pipeline state and breaks when the pipeline has finished. And that''s my question.

eloso

Share this post


Link to post
Share on other sites
The second is right.I explain it so(ofcourse this is my opinion).glFinish posts some command to the pipeline and blocks it.When it the posted message is resieved the pipeline is clear.

The PAIN is coming...this summer!!!In cinemas everywhere.

Share this post


Link to post
Share on other sites
If i understood you right it is not a good idea to call glFinish directly after all gl calls if maybe some AI could be computed for the next frame even if they are in another thread. So it is better to first do all the rendering stuff and then compute ai/physics/sound/... as long as you guess the pipeline would need to finish, right?

Btw. is it possible to just check whether the pipeline has finished?

sorry for my obtrusive asking, but i think this is a very important aspect which is not covered by any OpenGL book i''ve read.

eloso

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!