Mercurial > sdl-ios-xcode
comparison test/testgl.c @ 1737:eacc5bc01d1c
Implemented bug #5
Added SDL_GL_ACCELERATED_VISUAL to guarantee hardware acceleration.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 27 Apr 2006 08:39:51 +0000 |
parents | 3b2a92126f4d |
children | 871090feb7ad |
comparison
equal
deleted
inserted
replaced
1736:3b2a92126f4d | 1737:eacc5bc01d1c |
---|---|
443 /* Show the image on the screen */ | 443 /* Show the image on the screen */ |
444 SDL_UpdateRects(screen, 1, &dst); | 444 SDL_UpdateRects(screen, 1, &dst); |
445 } | 445 } |
446 | 446 |
447 int RunGLTest( int argc, char* argv[], | 447 int RunGLTest( int argc, char* argv[], |
448 int logo, int logocursor, int slowly, int bpp, float gamma, int noframe, int fsaa, int sync ) | 448 int logo, int logocursor, int slowly, int bpp, float gamma, int noframe, int fsaa, int sync, int accel ) |
449 { | 449 { |
450 int i; | 450 int i; |
451 int rgb_size[3]; | 451 int rgb_size[3]; |
452 int w = 640; | 452 int w = 640; |
453 int h = 480; | 453 int h = 480; |
529 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); | 529 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); |
530 if ( fsaa ) { | 530 if ( fsaa ) { |
531 SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 ); | 531 SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 ); |
532 SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, fsaa ); | 532 SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, fsaa ); |
533 } | 533 } |
534 if ( accel ) { | |
535 SDL_GL_SetAttribute( SDL_GL_ACCELERATED_VISUAL, 1 ); | |
536 } | |
534 if ( sync ) { | 537 if ( sync ) { |
535 SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 1 ); | 538 SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 1 ); |
536 } else { | 539 } else { |
537 SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 0 ); | 540 SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 0 ); |
538 } | 541 } |
563 if ( fsaa ) { | 566 if ( fsaa ) { |
564 SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &value ); | 567 SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &value ); |
565 printf("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value ); | 568 printf("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value ); |
566 SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &value ); | 569 SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &value ); |
567 printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value ); | 570 printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value ); |
571 } | |
572 if ( accel ) { | |
573 SDL_GL_GetAttribute( SDL_GL_ACCELERATED_VISUAL, &value ); | |
574 printf( "SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value ); | |
568 } | 575 } |
569 if ( sync ) { | 576 if ( sync ) { |
570 SDL_GL_GetAttribute( SDL_GL_SWAP_CONTROL, &value ); | 577 SDL_GL_GetAttribute( SDL_GL_SWAP_CONTROL, &value ); |
571 printf( "SDL_GL_SWAP_CONTROL: requested 1, got %d\n", value ); | 578 printf( "SDL_GL_SWAP_CONTROL: requested 1, got %d\n", value ); |
572 } | 579 } |
777 int bpp = 0; | 784 int bpp = 0; |
778 int slowly; | 785 int slowly; |
779 float gamma = 0.0; | 786 float gamma = 0.0; |
780 int noframe = 0; | 787 int noframe = 0; |
781 int fsaa = 0; | 788 int fsaa = 0; |
789 int accel = 0; | |
782 int sync = 0; | 790 int sync = 0; |
783 | 791 |
784 logo = 0; | 792 logo = 0; |
785 slowly = 0; | 793 slowly = 0; |
786 numtests = 1; | 794 numtests = 1; |
812 noframe = 1; | 820 noframe = 1; |
813 } | 821 } |
814 if ( strcmp(argv[i], "-fsaa") == 0 ) { | 822 if ( strcmp(argv[i], "-fsaa") == 0 ) { |
815 ++fsaa; | 823 ++fsaa; |
816 } | 824 } |
825 if ( strcmp(argv[i], "-accel") == 0 ) { | |
826 ++accel; | |
827 } | |
817 if ( strcmp(argv[i], "-sync") == 0 ) { | 828 if ( strcmp(argv[i], "-sync") == 0 ) { |
818 ++sync; | 829 ++sync; |
819 } | 830 } |
820 if ( strncmp(argv[i], "-h", 2) == 0 ) { | 831 if ( strncmp(argv[i], "-h", 2) == 0 ) { |
821 printf( | 832 printf( |
823 argv[0]); | 834 argv[0]); |
824 exit(0); | 835 exit(0); |
825 } | 836 } |
826 } | 837 } |
827 for ( i=0; i<numtests; ++i ) { | 838 for ( i=0; i<numtests; ++i ) { |
828 RunGLTest(argc, argv, logo, logocursor, slowly, bpp, gamma, noframe, fsaa, sync); | 839 RunGLTest(argc, argv, logo, logocursor, slowly, bpp, gamma, noframe, fsaa, sync, accel); |
829 } | 840 } |
830 return 0; | 841 return 0; |
831 } | 842 } |
832 | 843 |
833 #else /* HAVE_OPENGL */ | 844 #else /* HAVE_OPENGL */ |