Fixed bug #260
authorSam Lantinga <slouken@libsdl.org>
Sat, 24 Jun 2006 01:59:43 +0000
changeset 18809d940db55a91
parent 1879 cb232e63552c
child 1881 61f86f36afb9
Fixed bug #260

Fixed SDL_GL_SWAP_CONTROL on Windows, and the query on Linux
src/video/wincommon/SDL_wingl.c
src/video/x11/SDL_x11gl.c
test/testgl.c
     1.1 --- a/src/video/wincommon/SDL_wingl.c	Fri Jun 23 08:39:05 2006 +0000
     1.2 +++ b/src/video/wincommon/SDL_wingl.c	Sat Jun 24 01:59:43 2006 +0000
     1.3 @@ -346,7 +346,10 @@
     1.4  		/* Uh oh, something is seriously wrong here... */
     1.5  		wglext = NULL;
     1.6  	}
     1.7 -	if ( !wglext || !SDL_strstr(wglext, "WGL_EXT_swap_control") ) {
     1.8 +	if ( wglext && SDL_strstr(wglext, "WGL_EXT_swap_control") ) {
     1.9 +		this->gl_data->wglSwapIntervalEXT = WIN_GL_GetProcAddress(this, "wglSwapIntervalEXT");
    1.10 +		this->gl_data->wglGetSwapIntervalEXT = WIN_GL_GetProcAddress(this, "wglGetSwapIntervalEXT");
    1.11 +	} else {
    1.12  		this->gl_data->wglSwapIntervalEXT = NULL;
    1.13  		this->gl_data->wglGetSwapIntervalEXT = NULL;
    1.14  	}
    1.15 @@ -466,10 +469,12 @@
    1.16  			break;
    1.17  		    case SDL_GL_SWAP_CONTROL:
    1.18  			if ( this->gl_data->wglGetSwapIntervalEXT ) {
    1.19 -				return this->gl_data->wglGetSwapIntervalEXT();
    1.20 +				*value = this->gl_data->wglGetSwapIntervalEXT();
    1.21 +				return 0;
    1.22  			} else {
    1.23  				return -1;
    1.24  			}
    1.25 +			break;
    1.26  		    default:
    1.27  			return(-1);
    1.28  		}
    1.29 @@ -533,6 +538,14 @@
    1.30  	    case SDL_GL_MULTISAMPLESAMPLES:
    1.31  		*value = 1;
    1.32  		break;
    1.33 +	    case SDL_GL_SWAP_CONTROL:
    1.34 +		if ( this->gl_data->wglGetSwapIntervalEXT ) {
    1.35 +			*value = this->gl_data->wglGetSwapIntervalEXT();
    1.36 +			return 0;
    1.37 +		} else {
    1.38 +			return -1;
    1.39 +		}
    1.40 +		break;
    1.41  	    default:
    1.42  		retval = -1;
    1.43  		break;
     2.1 --- a/src/video/x11/SDL_x11gl.c	Fri Jun 23 08:39:05 2006 +0000
     2.2 +++ b/src/video/x11/SDL_x11gl.c	Sat Jun 24 01:59:43 2006 +0000
     2.3 @@ -401,9 +401,10 @@
     2.4  		break;
     2.5  	    case SDL_GL_SWAP_CONTROL:
     2.6  		if ( this->gl_data->glXGetSwapIntervalMESA ) {
     2.7 -			return this->gl_data->glXGetSwapIntervalMESA();
     2.8 +			*value = this->gl_data->glXGetSwapIntervalMESA();
     2.9 +			return(0);
    2.10  		} else {
    2.11 -			return(-1)/*(this->gl_config.swap_control > 0)*/;
    2.12 +			return(-1);
    2.13  		}
    2.14  		break;
    2.15  	    default:
     3.1 --- a/test/testgl.c	Fri Jun 23 08:39:05 2006 +0000
     3.2 +++ b/test/testgl.c	Sat Jun 24 01:59:43 2006 +0000
     3.3 @@ -834,7 +834,7 @@
     3.4  		}
     3.5  		if ( strncmp(argv[i], "-h", 2) == 0 ) {
     3.6   		       printf(
     3.7 -"Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-fullscreen]\n",
     3.8 +"Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-accel] [-sync] [-fullscreen]\n",
     3.9   			      argv[0]);
    3.10  			exit(0);
    3.11  		}