test/testgl2.c
changeset 3571 19691cebb866
parent 3570 7812d3e9564e
child 5244 762e40fb8e28
     1.1 --- a/test/testgl2.c	Tue Dec 15 20:36:31 2009 +0000
     1.2 +++ b/test/testgl2.c	Tue Dec 15 20:53:09 2009 +0000
     1.3 @@ -162,7 +162,7 @@
     1.4  int
     1.5  main(int argc, char *argv[])
     1.6  {
     1.7 -    int fsaa, noaccel;
     1.8 +    int fsaa, accel;
     1.9      int value;
    1.10      int i, done;
    1.11      SDL_DisplayMode mode;
    1.12 @@ -172,7 +172,7 @@
    1.13  
    1.14      /* Initialize parameters */
    1.15      fsaa = 0;
    1.16 -    noaccel = 0;
    1.17 +    accel = -1;
    1.18  
    1.19      /* Initialize test framework */
    1.20      state = CommonCreateState(argv, SDL_INIT_VIDEO);
    1.21 @@ -187,15 +187,15 @@
    1.22              if (SDL_strcasecmp(argv[i], "--fsaa") == 0) {
    1.23                  ++fsaa;
    1.24                  consumed = 1;
    1.25 -            } else if (SDL_strcasecmp(argv[i], "--noaccel") == 0) {
    1.26 -                ++noaccel;
    1.27 -                consumed = 1;
    1.28 +            } else if (SDL_strcasecmp(argv[i], "--accel") == 0 && i+1 < argc) {
    1.29 +                accel = atoi(argv[i+1]);
    1.30 +                consumed = 2;
    1.31              } else {
    1.32                  consumed = -1;
    1.33              }
    1.34          }
    1.35          if (consumed < 0) {
    1.36 -            fprintf(stderr, "Usage: %s %s [--fsaa] [--noaccel]\n", argv[0],
    1.37 +            fprintf(stderr, "Usage: %s %s [--fsaa] [--accel n]\n", argv[0],
    1.38                      CommonUsage(state));
    1.39              quit(1);
    1.40          }
    1.41 @@ -213,7 +213,9 @@
    1.42          state->gl_multisamplebuffers = 1;
    1.43          state->gl_multisamplesamples = fsaa;
    1.44      }
    1.45 -    state->gl_accelerated = !noaccel;
    1.46 +    if (accel >= 0) {
    1.47 +        state->gl_accelerated = accel;
    1.48 +    }
    1.49  
    1.50      if (!CommonInit(state)) {
    1.51          quit(2);
    1.52 @@ -282,13 +284,15 @@
    1.53                     SDL_GetError());
    1.54          }
    1.55      }
    1.56 -    status = SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
    1.57 -    if (!status) {
    1.58 -        printf("SDL_GL_ACCELERATED_VISUAL: requested %d, got %d\n", !noaccel,
    1.59 -               value);
    1.60 -    } else {
    1.61 -        printf("Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
    1.62 -               SDL_GetError());
    1.63 +    if (accel >= 0) {
    1.64 +        status = SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
    1.65 +        if (!status) {
    1.66 +            printf("SDL_GL_ACCELERATED_VISUAL: requested %d, got %d\n", accel,
    1.67 +                   value);
    1.68 +        } else {
    1.69 +            printf("Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
    1.70 +                   SDL_GetError());
    1.71 +        }
    1.72      }
    1.73  
    1.74      /* Set rendering settings */