View Single Post
Old 10-29-10, 02:00 PM   #2
AaronP
NVIDIA Corporation
 
AaronP's Avatar
 
Join Date: Mar 2005
Posts: 2,487
Default Re: glX VSYNC does not work with ACER GD245HQ

glXWaitVideoSyncSGI only waits on the CPU for that particular vblank count to be reached. It does not guarantee that anything else happens during vblank. In particular, the SwapBuffers call schedules a swap for some unspecified time in the future. In addition, your call to glFinish() is an unnecessary bottleneck in your program: it waits on the CPU for all of the rendering to complete.

It sounds like what you want instead is to set the swap interval for your drawable to 1: this causes SwapBuffers to wait until the next vblank interval to actually perform the swap. This allows the CPU to start processing the next frame and also helps reduce tearing. You can do that by deleting your calls to glFinish(), glXGetVideoSyncSGI(), and glXWaitVideoSyncSGI(), and adding a call to either glXSwapIntervalEXT() or glXSwapIntervalSGI() to your program's initialization (you only need to set the swap interval once, rather than once per frame).
AaronP is offline   Reply With Quote