Advertisement

enable v-sync in openGL app

Started by September 29, 2006 09:06 AM
1 comment, last by DeMohn 18 years, 2 months ago
hi there, i have to be able to enable or disable v-sync in my openGL application. I am using glut to create the main window. Any idea how to do that? thanks in advance, DeMohn
void InitVSync(){   char* extensions = (char*)glGetString(GL_EXTENSIONS);   if (strstr(extensions,"WGL_EXT_swap_control"))   {      wglSwapIntervalEXT = (PFNWGLEXTSWAPCONTROLPROC)          wglGetProcAddress("wglSwapIntervalEXT");      wglGetSwapIntervalEXT = (PFNWGLEXTGETSWAPINTERVALPROC)          wglGetProcAddress("wglGetSwapIntervalEXT");  }}void SetVSync(bool VSync){    wglSwapIntervalEXT(VSync ? 1 : 0);}bool GetVSync(){    return wglGetSwapIntervalEXT()==0 ? false : true;}
Advertisement
thanks a lot, Kambiz!

This topic is closed to new replies.

Advertisement