test/testgl.c
branchSDL-1.3
changeset 1656 96c2f89cc7e1
parent 1654 0a53c90a37f9
child 1659 14717b52abc0
     1.1 --- a/test/testgl.c	Thu Apr 27 05:49:51 2006 +0000
     1.2 +++ b/test/testgl.c	Thu Apr 27 09:09:48 2006 +0000
     1.3 @@ -361,7 +361,7 @@
     1.4  }
     1.5  
     1.6  int RunGLTest( int argc, char* argv[],
     1.7 -               int logo, int logocursor, int slowly, int bpp, float gamma, int noframe, int fsaa )
     1.8 +               int logo, int logocursor, int slowly, int bpp, float gamma, int noframe, int fsaa, int sync, int accel )
     1.9  {
    1.10  	int i;
    1.11  	int rgb_size[3];
    1.12 @@ -443,6 +443,14 @@
    1.13  		SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
    1.14  		SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, fsaa );
    1.15  	}
    1.16 +	if ( accel ) {
    1.17 +		SDL_GL_SetAttribute( SDL_GL_ACCELERATED_VISUAL, 1 );
    1.18 +	}
    1.19 +	if ( sync ) {
    1.20 +		SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 1 );
    1.21 +	} else {
    1.22 +		SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 0 );
    1.23 +	}
    1.24  	if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) {
    1.25  		fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
    1.26  		SDL_Quit();
    1.27 @@ -469,9 +477,17 @@
    1.28  	printf( "SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value );
    1.29  	if ( fsaa ) {
    1.30  		SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &value );
    1.31 -		printf( "SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value );
    1.32 +		printf("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value );
    1.33  		SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &value );
    1.34 -		printf( "SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value );
    1.35 +		printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value );
    1.36 +	}
    1.37 +	if ( accel ) {
    1.38 +		SDL_GL_GetAttribute( SDL_GL_ACCELERATED_VISUAL, &value );
    1.39 +		printf( "SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value );
    1.40 +	}
    1.41 +	if ( sync ) {
    1.42 +		SDL_GL_GetAttribute( SDL_GL_SWAP_CONTROL, &value );
    1.43 +		printf( "SDL_GL_SWAP_CONTROL: requested 1, got %d\n", value );
    1.44  	}
    1.45  
    1.46  	/* Set the window manager title bar */
    1.47 @@ -678,6 +694,8 @@
    1.48  	float gamma = 0.0;
    1.49  	int noframe = 0;
    1.50  	int fsaa = 0;
    1.51 +	int accel = 0;
    1.52 +	int sync = 0;
    1.53  
    1.54  	logo = 0;
    1.55  	slowly = 0;
    1.56 @@ -707,6 +725,12 @@
    1.57  		if ( strcmp(argv[i], "-fsaa") == 0 ) {
    1.58   		       ++fsaa;
    1.59  		}
    1.60 +		if ( strcmp(argv[i], "-accel") == 0 ) {
    1.61 + 		       ++accel;
    1.62 +		}
    1.63 +		if ( strcmp(argv[i], "-sync") == 0 ) {
    1.64 + 		       ++sync;
    1.65 +		}
    1.66  		if ( strncmp(argv[i], "-h", 2) == 0 ) {
    1.67   		       printf(
    1.68  "Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-fullscreen]\n",
    1.69 @@ -715,7 +739,7 @@
    1.70  		}
    1.71  	}
    1.72  	for ( i=0; i<numtests; ++i ) {
    1.73 - 		RunGLTest(argc, argv, logo, logocursor, slowly, bpp, gamma, noframe, fsaa);
    1.74 + 		RunGLTest(argc, argv, logo, logocursor, slowly, bpp, gamma, noframe, fsaa, sync, accel);
    1.75  	}
    1.76  	return 0;
    1.77  }