PDA

View Full Version : Lock swapbuffers to frame rate



phacoboy
12-25-2012, 08:02 PM
I am developing an application for research in which I need extreme precision of frame updates.

The graphics is very simple - a high resolution checkerboard which inverts every 4 frames. The key thing is that there must be no dropped frames or variation of the update rate. I thought of simply having the two images in double buffered memory and simply issuing the swapbuffers command to flip them but I don't know a way of tying the code execution to the vsync. The same thing could be achieved by translating the pattern horizontally or vertically by one square except that the image would need to be bigger than the screen so that the edges don't move. Is there any simple way to do this fairly simple task with the required precision?

Any help much appreciated

eile
12-26-2012, 02:59 AM
See glXSwapIntervalSGI. If you can guarantee to call you swapbuffers faster than 16ms, this will give you a steady 60Hz on a 60Hz monitor.

V-man
12-29-2012, 06:27 AM
http://www.opengl.org/wiki/Platform_specifics:_Windows#SwapInterval_aka_vsync