🎉 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 vsync in opengl
Hi,
I was looking at this thread but it's been retired.
http://www.gamedev.net/community/forums/topic.asp?topic_id=417071&whichpage=1?
I wanted to ask how I use the code?
Thanks
Retired? I can open that page just fine. All the code is there.
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;
}
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;
}
i can see the thread, just not reply to it.
i'm able to get up a window using glut, i just don't know how to implement the code. do i also need to deal with extensions?
i'm able to get up a window using glut, i just don't know how to implement the code. do i also need to deal with extensions?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement