Flushing

I was wondering, saves me testing this!
I need to draw something and then recover the data using readpixels. Can the front buffer become corrupted, by other windows covering it say? So would it be safer to read from the back buffer. does glFlush work on the back buffer in double buffered mode? Does this degrade performance?

Hi !

There is no problem, both buffers are kept in video memory (hopefully) so what goes on on the screen does not have any impact on that as long as you use glReadPixels, now do remember that glReadPixels in itself is pretty slow though…

If you would use GDI functions to try to read the window contents, then you would have run into the problem you describe.

Mikael

Originally posted by Gavin:
I was wondering, saves me testing this!
I need to draw something and then recover the data using readpixels. Can the front buffer become corrupted, by other windows covering it say? So would it be safer to read from the back buffer. does glFlush work on the back buffer in double buffered mode? Does this degrade performance?

Gavin,

Both the FRONT and the BACK buffer are undefined for areas that are off-screen or obscured by other windows.
To have absolute guarantees that glReadPixels will return the actual results of your drawings you have to use an off-screen buffer like a pbuffer.

HTH

Jean-Marc

That was a possibility but wasn’t sure on how much hassle pbuffers would be for cross platform.