PDA

View Full Version : Flushing



Gavin
10-04-2002, 05:18 AM
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?

mikael_aronsson
10-07-2002, 05:38 AM
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

JML
10-07-2002, 06:25 AM
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

Gavin
10-08-2002, 01:30 AM
That was a possibility but wasn't sure on how much hassle pbuffers would be for cross platform.