implement vsync

This commit is contained in:
Glenn Maynard
2002-11-12 19:29:45 +00:00
parent 12c2a81174
commit 78fb452cd3
+12
View File
@@ -61,6 +61,9 @@ static int g_iFramesRenderedSinceLastCheck,
set<string> g_glExts;
static bool g_GL_EXT_texture_env_combine;
typedef BOOL (APIENTRY * PWSWAPINTERVALEXTPROC) (int interval);
PWSWAPINTERVALEXTPROC wglSwapIntervalEXT;
void GetGLExtensions(set<string> &ext)
{
const char *buf = (const char *)glGetString(GL_EXTENSIONS);
@@ -90,6 +93,10 @@ RageDisplay::RageDisplay( bool windowed, int width, int height, int bpp, int rat
glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC) SDL_GL_GetProcAddress ("glBlendFuncSeparate");
/* Windows vsync: */
if(g_glExts.find("WGL_EXT_swap_control") != g_glExts.end())
wglSwapIntervalEXT = (PWSWAPINTERVALEXTPROC) SDL_GL_GetProcAddress("wglSwapIntervalEXT");
SetupOpenGL();
}
@@ -172,6 +179,11 @@ bool RageDisplay::SetVideoMode( bool windowed, int width, int height, int bpp, i
}
#endif
/* Set vsync the Windows way, if we can. (What other extensions are there
* to do this, for other archs?) */
if(wglSwapIntervalEXT)
wglSwapIntervalEXT(vsync);
if(!g_screen) {
g_screen = SDL_SetVideoMode(width, height, bpp, g_flags);
if(!g_screen)