From e9e6c15910be09d43c8467f67ffced01ee2f4859 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 24 Jun 2006 01:59:43 +0000 Subject: [PATCH] Fixed bug #260 Fixed SDL_GL_SWAP_CONTROL on Windows, and the query on Linux --- src/video/wincommon/SDL_wingl.c | 17 +++++++++++++++-- src/video/x11/SDL_x11gl.c | 5 +++-- test/testgl.c | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/video/wincommon/SDL_wingl.c b/src/video/wincommon/SDL_wingl.c index d98dbfeba..05933421c 100644 --- a/src/video/wincommon/SDL_wingl.c +++ b/src/video/wincommon/SDL_wingl.c @@ -346,7 +346,10 @@ int WIN_GL_SetupWindow(_THIS) /* Uh oh, something is seriously wrong here... */ wglext = NULL; } - if ( !wglext || !SDL_strstr(wglext, "WGL_EXT_swap_control") ) { + if ( wglext && SDL_strstr(wglext, "WGL_EXT_swap_control") ) { + this->gl_data->wglSwapIntervalEXT = WIN_GL_GetProcAddress(this, "wglSwapIntervalEXT"); + this->gl_data->wglGetSwapIntervalEXT = WIN_GL_GetProcAddress(this, "wglGetSwapIntervalEXT"); + } else { this->gl_data->wglSwapIntervalEXT = NULL; this->gl_data->wglGetSwapIntervalEXT = NULL; } @@ -466,10 +469,12 @@ int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) break; case SDL_GL_SWAP_CONTROL: if ( this->gl_data->wglGetSwapIntervalEXT ) { - return this->gl_data->wglGetSwapIntervalEXT(); + *value = this->gl_data->wglGetSwapIntervalEXT(); + return 0; } else { return -1; } + break; default: return(-1); } @@ -533,6 +538,14 @@ int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) case SDL_GL_MULTISAMPLESAMPLES: *value = 1; break; + case SDL_GL_SWAP_CONTROL: + if ( this->gl_data->wglGetSwapIntervalEXT ) { + *value = this->gl_data->wglGetSwapIntervalEXT(); + return 0; + } else { + return -1; + } + break; default: retval = -1; break; diff --git a/src/video/x11/SDL_x11gl.c b/src/video/x11/SDL_x11gl.c index 8fa5b53dc..43334c10f 100644 --- a/src/video/x11/SDL_x11gl.c +++ b/src/video/x11/SDL_x11gl.c @@ -401,9 +401,10 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) break; case SDL_GL_SWAP_CONTROL: if ( this->gl_data->glXGetSwapIntervalMESA ) { - return this->gl_data->glXGetSwapIntervalMESA(); + *value = this->gl_data->glXGetSwapIntervalMESA(); + return(0); } else { - return(-1)/*(this->gl_config.swap_control > 0)*/; + return(-1); } break; default: diff --git a/test/testgl.c b/test/testgl.c index 4e73e948d..34b88cfba 100644 --- a/test/testgl.c +++ b/test/testgl.c @@ -834,7 +834,7 @@ int main(int argc, char *argv[]) } if ( strncmp(argv[i], "-h", 2) == 0 ) { printf( -"Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-fullscreen]\n", +"Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-accel] [-sync] [-fullscreen]\n", argv[0]); exit(0); }