Mercurial > sdl-ios-xcode
comparison test/testgl.c @ 3571:19691cebb866
Default to allow either accelerated or not
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 15 Dec 2009 20:53:09 +0000 |
parents | 7812d3e9564e |
children | f8816ffa210b |
comparison
equal
deleted
inserted
replaced
3570:7812d3e9564e | 3571:19691cebb866 |
---|---|
368 } | 368 } |
369 | 369 |
370 int | 370 int |
371 RunGLTest(int argc, char *argv[], | 371 RunGLTest(int argc, char *argv[], |
372 int logo, int logocursor, int slowly, int bpp, float gamma, | 372 int logo, int logocursor, int slowly, int bpp, float gamma, |
373 int noframe, int fsaa, int sync, int noaccel) | 373 int noframe, int fsaa, int sync, int accel) |
374 { | 374 { |
375 int i; | 375 int i; |
376 int rgb_size[3]; | 376 int rgb_size[3]; |
377 int w = 640; | 377 int w = 640; |
378 int h = 480; | 378 int h = 480; |
452 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); | 452 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); |
453 if (fsaa) { | 453 if (fsaa) { |
454 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); | 454 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); |
455 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, fsaa); | 455 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, fsaa); |
456 } | 456 } |
457 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, !noaccel); | 457 if (accel >= 0) { |
458 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, accel); | |
459 } | |
458 if (SDL_SetVideoMode(w, h, bpp, video_flags) == NULL) { | 460 if (SDL_SetVideoMode(w, h, bpp, video_flags) == NULL) { |
459 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); | 461 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); |
460 SDL_Quit(); | 462 SDL_Quit(); |
461 exit(1); | 463 exit(1); |
462 } | 464 } |
489 printf("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value); | 491 printf("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value); |
490 SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value); | 492 SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value); |
491 printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, | 493 printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, |
492 value); | 494 value); |
493 } | 495 } |
494 SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value); | 496 if (accel >= 0) { |
495 printf("SDL_GL_ACCELERATED_VISUAL: requested %d, got %d\n", !noaccel, value); | 497 SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value); |
498 printf("SDL_GL_ACCELERATED_VISUAL: requested %d, got %d\n", accel, | |
499 value); | |
500 } | |
496 if (sync) { | 501 if (sync) { |
497 printf("Buffer swap interval: requested 1, got %d\n", | 502 printf("Buffer swap interval: requested 1, got %d\n", |
498 SDL_GL_GetSwapInterval()); | 503 SDL_GL_GetSwapInterval()); |
499 } | 504 } |
500 | 505 |
701 int bpp = 0; | 706 int bpp = 0; |
702 int slowly; | 707 int slowly; |
703 float gamma = 0.0; | 708 float gamma = 0.0; |
704 int noframe = 0; | 709 int noframe = 0; |
705 int fsaa = 0; | 710 int fsaa = 0; |
706 int noaccel = 0; | 711 int accel = -1; |
707 int sync = 0; | 712 int sync = 0; |
708 | 713 |
709 logo = 0; | 714 logo = 0; |
710 slowly = 0; | 715 slowly = 0; |
711 numtests = 1; | 716 numtests = 1; |
732 noframe = 1; | 737 noframe = 1; |
733 } | 738 } |
734 if (strcmp(argv[i], "-fsaa") == 0) { | 739 if (strcmp(argv[i], "-fsaa") == 0) { |
735 ++fsaa; | 740 ++fsaa; |
736 } | 741 } |
737 if (strcmp(argv[i], "-noaccel") == 0) { | 742 if (strcmp(argv[i], "-accel") == 0) { |
738 ++noaccel; | 743 accel = atoi(argv[++i]); |
739 } | 744 } |
740 if (strcmp(argv[i], "-sync") == 0) { | 745 if (strcmp(argv[i], "-sync") == 0) { |
741 ++sync; | 746 ++sync; |
742 } | 747 } |
743 if (strncmp(argv[i], "-h", 2) == 0) { | 748 if (strncmp(argv[i], "-h", 2) == 0) { |
744 printf | 749 printf |
745 ("Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-noaccel] [-sync] [-fullscreen]\n", | 750 ("Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-accel n] [-sync] [-fullscreen]\n", |
746 argv[0]); | 751 argv[0]); |
747 exit(0); | 752 exit(0); |
748 } | 753 } |
749 } | 754 } |
750 for (i = 0; i < numtests; ++i) { | 755 for (i = 0; i < numtests; ++i) { |
751 RunGLTest(argc, argv, logo, logocursor, slowly, bpp, gamma, | 756 RunGLTest(argc, argv, logo, logocursor, slowly, bpp, gamma, |
752 noframe, fsaa, sync, noaccel); | 757 noframe, fsaa, sync, accel); |
753 } | 758 } |
754 return 0; | 759 return 0; |
755 } | 760 } |
756 | 761 |
757 #else /* HAVE_OPENGL */ | 762 #else /* HAVE_OPENGL */ |