implement vsync
This commit is contained in:
@@ -61,6 +61,9 @@ static int g_iFramesRenderedSinceLastCheck,
|
|||||||
set<string> g_glExts;
|
set<string> g_glExts;
|
||||||
static bool g_GL_EXT_texture_env_combine;
|
static bool g_GL_EXT_texture_env_combine;
|
||||||
|
|
||||||
|
typedef BOOL (APIENTRY * PWSWAPINTERVALEXTPROC) (int interval);
|
||||||
|
PWSWAPINTERVALEXTPROC wglSwapIntervalEXT;
|
||||||
|
|
||||||
void GetGLExtensions(set<string> &ext)
|
void GetGLExtensions(set<string> &ext)
|
||||||
{
|
{
|
||||||
const char *buf = (const char *)glGetString(GL_EXTENSIONS);
|
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");
|
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();
|
SetupOpenGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,6 +179,11 @@ bool RageDisplay::SetVideoMode( bool windowed, int width, int height, int bpp, i
|
|||||||
}
|
}
|
||||||
#endif
|
#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) {
|
if(!g_screen) {
|
||||||
g_screen = SDL_SetVideoMode(width, height, bpp, g_flags);
|
g_screen = SDL_SetVideoMode(width, height, bpp, g_flags);
|
||||||
if(!g_screen)
|
if(!g_screen)
|
||||||
|
|||||||
Reference in New Issue
Block a user