diff src/video/wincommon/SDL_wingl.c @ 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 290b5baf2fca
children c121d94672cb 5c6e937518c6
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;