Lock swapbuffers to frame rate
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