🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

enable v-sync in openGL app

Started by
1 comment, last by DeMohn 17 years, 9 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
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;}
thanks a lot, Kambiz!

This topic is closed to new replies.

Advertisement