PDA

View Full Version : Portable sync to vblank?



Stuart McDonald
09-08-2006, 09:04 AM
Hi,

Is there a portable way to sync to vblank? I'm running under cygwin with GLUT and an NVIDIA card a CRT and it automatically is sync'ing, but on someone elses laptap the dame program didn't.

If there's not a portable way, is there any info on the subject in general? I found mention of the NVIDIA environment variable __GL_SYNC_TO_VBLANK, but I can't seem to get that to make any difference.

Cheers,

Stuart.

VCarnage
09-08-2006, 11:05 AM
I'm not sure if you mean vsync. But if you do, then you can use SwapInterval to control whether your app is vsync'd or not. This works on linux and windows.

#if defined(WIN32)
wglSwapIntervalEXT(interval);
#else
glXSwapIntervalSGI(interval);
#endif

interval is 1 for vsync on, 0 for off

Also, this only works if your driver settings are for application-controlled vsync, not forced off/on.

HTH
-VC

Stuart McDonald
09-08-2006, 02:03 PM
That's exactly what I was looking for!

Thanks,

Stuart.