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

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401671
This commit is contained in:
Sam Lantinga 2006-04-27 07:59:16 +00:00
parent f1c75141ad
commit b32d3f9c24
10 changed files with 114 additions and 10 deletions

View file

@ -445,7 +445,7 @@ void DrawLogoBlit(void)
}
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 @@ int RunGLTest( int argc, char* argv[],
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 @@ int RunGLTest( int argc, char* argv[],
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 @@ int main(int argc, char *argv[])
float gamma = 0.0;
int noframe = 0;
int fsaa = 0;
int sync = 0;
logo = 0;
slowly = 0;
@ -804,6 +814,9 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
}
}
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;
}