In the WGL_EXT_swap_control specs it says that when you specify a swap interval of 0 buffer swaps are not synchronized to the video frame.
My question is, if my swap interval is 0(vsync disabled), does this mean that after I call SwapBuffers I can be sure that the buffers have been swapped? In other words, does SwapBuffers block until completion?
[EDIT] BTW, I am using double buffered pbuffers.
Thanks in advance
[This message has been edited by roffe (edited 04-04-2003).]
Vsync of swap is not the same as block on swap.
The implementations on Windows block on the second swap being issued. i.e swap only blocks IF there is another swap that hasn’t yet completed. Even with vsync set to 1 you will not be blocking, just waiting until retrace before the swap happens.
This is generally considered as ‘correct’ behaviour. Vendors always implement this because they can get more transmit & T&L done while waiting on the swap to happen.
To block, issue a glFinish after the swap. It is recommended that you try and utilize the CPU instead of waiting idle for vertical retrace. For latency purposes I advise polling input after a glFinish and doing the POV dynamic motion & other major dynamics, but only if this doesn’t take too long. This is an issue of contention with some vendors advising against this, they want you to exploit graphics capability instead of stalling the pipeline while you wait.
but it’s not possible to query to know if a swap is in progress, right?
Originally posted by dorbie:
To block, issue a glFinish after the swap.
Ok, thanks. I always considered SwapBuffers “separate” from the gl context, in the sense that I couldn’t control it. If I can use glFinish, I am assuming I can also insert a fence(NV_FENCE) and poll for its completion. Correct?