test/testgles.c
changeset 3408 55541ddf13e3
parent 3398 5ecc05616f39
child 4961 c92950635837
     1.1 --- a/test/testgles.c	Mon Oct 19 13:31:58 2009 +0000
     1.2 +++ b/test/testgles.c	Wed Oct 21 14:51:42 2009 +0000
     1.3 @@ -15,6 +15,7 @@
     1.4  
     1.5  static CommonState *state;
     1.6  static SDL_GLContext *context = NULL;
     1.7 +static int depth = 16;
     1.8  
     1.9  /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
    1.10  static void
    1.11 @@ -118,12 +119,20 @@
    1.12              } else if (SDL_strcasecmp(argv[i], "--accel") == 0) {
    1.13                  ++accel;
    1.14                  consumed = 1;
    1.15 +            } else if (SDL_strcasecmp(argv[i], "--zdepth") == 0) {
    1.16 +                i++;
    1.17 +                if (!argv[i]) {
    1.18 +                    consumed = -1;
    1.19 +                } else {
    1.20 +                    depth = SDL_atoi(argv[i]);
    1.21 +                    consumed = 1;
    1.22 +                }
    1.23              } else {
    1.24                  consumed = -1;
    1.25              }
    1.26          }
    1.27          if (consumed < 0) {
    1.28 -            fprintf(stderr, "Usage: %s %s [--fsaa] [--accel]\n", argv[0],
    1.29 +            fprintf(stderr, "Usage: %s %s [--fsaa] [--accel] [--zdepth %%d]\n", argv[0],
    1.30                      CommonUsage(state));
    1.31              quit(1);
    1.32          }
    1.33 @@ -132,16 +141,16 @@
    1.34  
    1.35      /* Set OpenGL parameters */
    1.36      state->window_flags |= SDL_WINDOW_OPENGL;
    1.37 -    SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
    1.38 -    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
    1.39 -    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
    1.40 -    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
    1.41 +    state->gl_red_size = 5;
    1.42 +    state->gl_green_size = 5;
    1.43 +    state->gl_blue_size = 5;
    1.44 +    state->gl_depth_size = depth;
    1.45      if (fsaa) {
    1.46 -        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
    1.47 -        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, fsaa);
    1.48 +        state->gl_multisamplebuffers=1;
    1.49 +        state->gl_multisamplesamples=fsaa;
    1.50      }
    1.51      if (accel) {
    1.52 -        SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
    1.53 +        state->gl_accelerated=1;
    1.54      }
    1.55      if (!CommonInit(state)) {
    1.56          quit(2);
    1.57 @@ -169,7 +178,7 @@
    1.58      }
    1.59  
    1.60      SDL_GetCurrentDisplayMode(&mode);
    1.61 -    printf("Screen BPP: %d\n", SDL_BITSPERPIXEL(mode.format));
    1.62 +    printf("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format));
    1.63      printf("\n");
    1.64      printf("Vendor     : %s\n", glGetString(GL_VENDOR));
    1.65      printf("Renderer   : %s\n", glGetString(GL_RENDERER));
    1.66 @@ -200,7 +209,7 @@
    1.67      }
    1.68      status = SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value);
    1.69      if (!status) {
    1.70 -        printf("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", 16, value);
    1.71 +        printf("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value);
    1.72      } else {
    1.73          fprintf(stderr, "Failed to get SDL_GL_DEPTH_SIZE: %s\n",
    1.74                  SDL_GetError());