enable v-sync in openGL app
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;}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement