i have a routine that draws some stuff in a 2d projection and i read the frame buffer to get the image. whatz happening is sometimes it works fine and sometimes it just reads 0s. it alwayz works if i step thru the code in debug mode. any help would be appreciated
'set projection to 2D othro to draw the vector image overlay and take a snapshot
gluOrtho2D dblTempXMin, dblTempXMax, dblTempYMin, dblTempYMax
From the GL spec, readpixels should occur after all drawing commands are actually done. Maybe is it not the case for your graphic card/driver, so put the glFinish before the readpixels call and see if it changes something.
Originally posted by ZbuffeR:
[b]Which card/drivers/system ?
And are you sure you read the right buffer ? back, front, swapbuffers, etc. Maybe try with single buffer window, to be sure.[/b]
i think im reading the right(back) buffer, cause i read the pixels before i swap the buffers. so i think it should be right. i need to try using a single buffer.
does glfinish swap the buffers?
can i switch from double buffers to single buffer and switch back to double?
i have an ATI RAEDON IGP 345M
Driver : 18.104.22.16838
my friend has a ATI MOBLILITY RAEDON 9000 and windows XP. on his system, the snapshot that i take is currupted intitially and behaves differently.
glFlush is weaker than glFinish. It is subtle, but glFinish only return when all the graphics commands have been processed, whereas glFlush just tell the hardware to actually proccess the commands as soon as possible (instead of waiting to fill the commands buffer).
Anyway, the default read buffer is the back buffer if you use double buffering, and readpixels is done after all previous command have been processed, so there should not be any problems about that. Can you simplify enougth the code to post it here completely ?