Window out of sync

Hello,

I am rendering an animation into a window. Each frame, I draw the scene, then read the pixels into a byte array, then I create a windows rgn from this byte array.

It works great, but it seems the rgn is 1 frame behind.

Any one have an idea?

Hi !

Could be a double buffer related problem, but it shouldnt, you copy data from the same buffer that you render to so you should get the same stuff as you render as long as you copy the contents at the end of the rendering step.

Mikael

Hey,

Yeah, I thought about the double buffering also, but that didnt make any sense. I even call glFinish to force all drawing, but it still doesnt work.

This is the order of what I do:
I draw the scene,
I read the pixels,
I swap the buffers,
I create the new region

I suppose it doesnt matter whether I create the region before or after the swapbuffers call…

When I call getIntegerv with gl_read_buffer as an arg, shouldnt i get glFront if I call it after swap buffers?