Mercurial > sdl-ios-xcode
comparison test/testgl.c @ 1656:96c2f89cc7e1 SDL-1.3
SDL-trunk-1.3-merge-1
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 27 Apr 2006 09:09:48 +0000 |
parents | 0a53c90a37f9 |
children | 14717b52abc0 |
comparison
equal
deleted
inserted
replaced
1655:59227394023d | 1656:96c2f89cc7e1 |
---|---|
359 glEnd(); | 359 glEnd(); |
360 SDL_GL_Leave2DMode(); | 360 SDL_GL_Leave2DMode(); |
361 } | 361 } |
362 | 362 |
363 int RunGLTest( int argc, char* argv[], | 363 int RunGLTest( int argc, char* argv[], |
364 int logo, int logocursor, int slowly, int bpp, float gamma, int noframe, int fsaa ) | 364 int logo, int logocursor, int slowly, int bpp, float gamma, int noframe, int fsaa, int sync, int accel ) |
365 { | 365 { |
366 int i; | 366 int i; |
367 int rgb_size[3]; | 367 int rgb_size[3]; |
368 int w = 640; | 368 int w = 640; |
369 int h = 480; | 369 int h = 480; |
441 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); | 441 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); |
442 if ( fsaa ) { | 442 if ( fsaa ) { |
443 SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 ); | 443 SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 ); |
444 SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, fsaa ); | 444 SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, fsaa ); |
445 } | 445 } |
446 if ( accel ) { | |
447 SDL_GL_SetAttribute( SDL_GL_ACCELERATED_VISUAL, 1 ); | |
448 } | |
449 if ( sync ) { | |
450 SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 1 ); | |
451 } else { | |
452 SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 0 ); | |
453 } | |
446 if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) { | 454 if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) { |
447 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); | 455 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); |
448 SDL_Quit(); | 456 SDL_Quit(); |
449 exit(1); | 457 exit(1); |
450 } | 458 } |
467 printf( "SDL_GL_DEPTH_SIZE: requested %d, got %d\n", bpp, value ); | 475 printf( "SDL_GL_DEPTH_SIZE: requested %d, got %d\n", bpp, value ); |
468 SDL_GL_GetAttribute( SDL_GL_DOUBLEBUFFER, &value ); | 476 SDL_GL_GetAttribute( SDL_GL_DOUBLEBUFFER, &value ); |
469 printf( "SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value ); | 477 printf( "SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value ); |
470 if ( fsaa ) { | 478 if ( fsaa ) { |
471 SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &value ); | 479 SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &value ); |
472 printf( "SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value ); | 480 printf("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value ); |
473 SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &value ); | 481 SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &value ); |
474 printf( "SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value ); | 482 printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value ); |
483 } | |
484 if ( accel ) { | |
485 SDL_GL_GetAttribute( SDL_GL_ACCELERATED_VISUAL, &value ); | |
486 printf( "SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value ); | |
487 } | |
488 if ( sync ) { | |
489 SDL_GL_GetAttribute( SDL_GL_SWAP_CONTROL, &value ); | |
490 printf( "SDL_GL_SWAP_CONTROL: requested 1, got %d\n", value ); | |
475 } | 491 } |
476 | 492 |
477 /* Set the window manager title bar */ | 493 /* Set the window manager title bar */ |
478 SDL_WM_SetCaption( "SDL GL test", "testgl" ); | 494 SDL_WM_SetCaption( "SDL GL test", "testgl" ); |
479 | 495 |
676 int bpp = 0; | 692 int bpp = 0; |
677 int slowly; | 693 int slowly; |
678 float gamma = 0.0; | 694 float gamma = 0.0; |
679 int noframe = 0; | 695 int noframe = 0; |
680 int fsaa = 0; | 696 int fsaa = 0; |
697 int accel = 0; | |
698 int sync = 0; | |
681 | 699 |
682 logo = 0; | 700 logo = 0; |
683 slowly = 0; | 701 slowly = 0; |
684 numtests = 1; | 702 numtests = 1; |
685 for ( i=1; argv[i]; ++i ) { | 703 for ( i=1; argv[i]; ++i ) { |
705 noframe = 1; | 723 noframe = 1; |
706 } | 724 } |
707 if ( strcmp(argv[i], "-fsaa") == 0 ) { | 725 if ( strcmp(argv[i], "-fsaa") == 0 ) { |
708 ++fsaa; | 726 ++fsaa; |
709 } | 727 } |
728 if ( strcmp(argv[i], "-accel") == 0 ) { | |
729 ++accel; | |
730 } | |
731 if ( strcmp(argv[i], "-sync") == 0 ) { | |
732 ++sync; | |
733 } | |
710 if ( strncmp(argv[i], "-h", 2) == 0 ) { | 734 if ( strncmp(argv[i], "-h", 2) == 0 ) { |
711 printf( | 735 printf( |
712 "Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-fullscreen]\n", | 736 "Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-fullscreen]\n", |
713 argv[0]); | 737 argv[0]); |
714 exit(0); | 738 exit(0); |
715 } | 739 } |
716 } | 740 } |
717 for ( i=0; i<numtests; ++i ) { | 741 for ( i=0; i<numtests; ++i ) { |
718 RunGLTest(argc, argv, logo, logocursor, slowly, bpp, gamma, noframe, fsaa); | 742 RunGLTest(argc, argv, logo, logocursor, slowly, bpp, gamma, noframe, fsaa, sync, accel); |
719 } | 743 } |
720 return 0; | 744 return 0; |
721 } | 745 } |
722 | 746 |
723 #else /* HAVE_OPENGL */ | 747 #else /* HAVE_OPENGL */ |