PDA

View Full Version : where to call screenshot method?



01-24-2005, 02:37 PM
I am trying to "animate" the display by rotating the model incrementally and would like to output a series of screenshots to show this animation.

I have another method which allows me to save a screenshot by using glReadPixels.

The problem is if i include this screenshot method in the display() to try to get successive screenshots, all i end up is a bunch of empty shots although the model is seen in the display window and changes.

Similarly, I tried to call this screenshot in a menu function that loops to succesively cause the display() to change. Again, the diplay window "animates" but i end up with a bunch of identical screenshots?

How can I achieve such a series of screenshots? Thanks!

dvm
01-24-2005, 06:02 PM
Well if you want to press a button I'd suggest you put an event handler for it. Tell us which api you're using for making the window so we can be more specific.
If you want to put it in the display function I'd bet it should go in the end, right after swapping buffers. Remember that opengl writes (in case of double buffering) in the back buffer and then the video card gets the data from there while the next frame is drawn in the "new" back buffer which was previously the front buffer.
Anyway I think if you put it in an event handler for a button you should be ok.

Overmind
01-24-2005, 10:59 PM
The initial value of ReadBuffer with a double buffered framebuffer is GL_BACK, so you should either put the screenshot call at the end of the display function, but before SwapBuffers, or call glReadBuffer(GL_FRONT) before the readback. After SwapBuffers the content of the backbuffer is undefined, so this could explain why you are getting empty screenshots...

01-25-2005, 10:33 AM
thanks guys! turns out that i was indeed calling screencapture() after glutSwapBuffers() and calling it before swap buffer solved it!