changeset 1880:9d940db55a91

Fixed bug #260 Fixed SDL_GL_SWAP_CONTROL on Windows, and the query on Linux
author Sam Lantinga <slouken@libsdl.org>
date Sat, 24 Jun 2006 01:59:43 +0000
parents cb232e63552c
children 61f86f36afb9
files src/video/wincommon/SDL_wingl.c src/video/x11/SDL_x11gl.c test/testgl.c
diffstat 3 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/wincommon/SDL_wingl.c	Fri Jun 23 08:39:05 2006 +0000
+++ b/src/video/wincommon/SDL_wingl.c	Sat Jun 24 01:59:43 2006 +0000
@@ -346,7 +346,10 @@
 		/* 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 @@
 			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 @@
 	    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;
--- a/src/video/x11/SDL_x11gl.c	Fri Jun 23 08:39:05 2006 +0000
+++ b/src/video/x11/SDL_x11gl.c	Sat Jun 24 01:59:43 2006 +0000
@@ -401,9 +401,10 @@
 		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:
--- a/test/testgl.c	Fri Jun 23 08:39:05 2006 +0000
+++ b/test/testgl.c	Sat Jun 24 01:59:43 2006 +0000
@@ -834,7 +834,7 @@
 		}
 		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);
 		}