Mercurial > sdl-ios-xcode
diff test/testgl.c @ 1736:3b2a92126f4d
Implemented bug #2, 117:
Date: Mon, 21 Mar 2005 12:06:14 +0100
From: Per Inge Mathisen
Subject: Re: [SDL] Outstanding patches?
The patch adds support for setting SDL_GL_SWAP_CONTROL to Windows and
X11. In Windows you can also query this enum to check that it is
working, or see what the default is - such functionality does not
exist in GLX. For more information on the standards implemented:
http://oss.sgi.com/projects/ogl-sample/registry/SGI/swap_control.txt
http://oss.sgi.com/projects/ogl-sample/registry/EXT/wgl_swap_control.txt
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 27 Apr 2006 07:59:16 +0000 |
parents | 4d3bb026cd16 |
children | eacc5bc01d1c |
line wrap: on
line diff
--- a/test/testgl.c Wed Apr 26 23:17:39 2006 +0000 +++ b/test/testgl.c Thu Apr 27 07:59:16 2006 +0000 @@ -445,7 +445,7 @@ } int RunGLTest( int argc, char* argv[], - int logo, int logocursor, int slowly, int bpp, float gamma, int noframe, int fsaa ) + int logo, int logocursor, int slowly, int bpp, float gamma, int noframe, int fsaa, int sync ) { int i; int rgb_size[3]; @@ -531,6 +531,11 @@ SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 ); SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, fsaa ); } + if ( sync ) { + SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 1 ); + } else { + SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 0 ); + } if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) { fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); SDL_Quit(); @@ -557,9 +562,13 @@ printf( "SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value ); if ( fsaa ) { SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &value ); - printf( "SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value ); + printf("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value ); SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &value ); - printf( "SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value ); + printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value ); + } + if ( sync ) { + SDL_GL_GetAttribute( SDL_GL_SWAP_CONTROL, &value ); + printf( "SDL_GL_SWAP_CONTROL: requested 1, got %d\n", value ); } /* Set the window manager title bar */ @@ -770,6 +779,7 @@ float gamma = 0.0; int noframe = 0; int fsaa = 0; + int sync = 0; logo = 0; slowly = 0; @@ -804,6 +814,9 @@ if ( strcmp(argv[i], "-fsaa") == 0 ) { ++fsaa; } + if ( strcmp(argv[i], "-sync") == 0 ) { + ++sync; + } if ( strncmp(argv[i], "-h", 2) == 0 ) { printf( "Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-fullscreen]\n", @@ -812,7 +825,7 @@ } } for ( i=0; i<numtests; ++i ) { - RunGLTest(argc, argv, logo, logocursor, slowly, bpp, gamma, noframe, fsaa); + RunGLTest(argc, argv, logo, logocursor, slowly, bpp, gamma, noframe, fsaa, sync); } return 0; }