Jump to content
  • Advertisement
Sign in to follow this  
LonelyStar

OpenGL Waiting for OpenGL operations to finish befor calling glCopyPixels

This topic is 5131 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

Hi everybody, I am doing the following: Every frame, I only draw the parts of the frame, that have changed (I store those reagons in rectangles). Afterwards, I copy those rectangles form the back buffer to the front buffer using glCopyPixels. Now my problem: Also I am calling glFinish befor calling glCopyPixels, it seems that the scene has not completed rendering when glCopyPixels is called. If I draw directly to the front buffer (and not using glCopyPixels), everything looks fine (except for some flickering of course, that's why I need to draw on the back buffer). But if I draw to the back-buffer and then call glCopyPixels to copy to the front buffer, some parts if the scene are not rendered at that point. If I put a sleep(2) befor glCopyPixels, the scene is complete (of course, this is not a solution). Why is glFinish not blocking until the scene is rendered? Any Ideas, any Help? Thanks!!!

Share this post


Link to post
Share on other sites
Advertisement
Well,try to put a glFlush() before glFinish(),but I'm 99% certain that glFlush()/glFinish() are needed to synchronize OpenGL and non-OpenGL operations,such as counting FPS,or waiting for user input.OpenGL commands will be executed at the right order.That is,by the time glCopyPixels are executed,all of the previous commands has been executed as well.Could you maybe post some code?

Share this post


Link to post
Share on other sites
OK, I am sorry. The problem was at a totally different point of my code. I was just to blind to see it!
Thank you, mikeman, for your response.

Share this post


Link to post
Share on other sites
For future reference, there is no need to call glFinish before glCopyPixels to get a correct results. gl commands are executed in order. If you get different results by doing this, you have found a driver bug that should be reported.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!