• Advertisement
Sign in to follow this  

enable v-sync in openGL app

This topic is 4130 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement


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;
}



Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement