test/testgles.c
changeset 5363 96799a165806
parent 4961 c92950635837
child 5520 09b500e0656d
     1.1 --- a/test/testgles.c	Sun Feb 20 13:56:57 2011 -0800
     1.2 +++ b/test/testgles.c	Sun Feb 20 14:16:11 2011 -0800
     1.3 @@ -177,7 +177,7 @@
     1.4          SDL_GL_SetSwapInterval(0);
     1.5      }
     1.6  
     1.7 -    SDL_GetCurrentDisplayMode(&mode);
     1.8 +    SDL_GetCurrentDisplayMode(0, &mode);
     1.9      printf("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format));
    1.10      printf("\n");
    1.11      printf("Vendor     : %s\n", glGetString(GL_VENDOR));
    1.12 @@ -243,6 +243,8 @@
    1.13  
    1.14      /* Set rendering settings for each context */
    1.15      for (i = 0; i < state->num_windows; ++i) {
    1.16 +        float aspectAdjust;
    1.17 +
    1.18          status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
    1.19          if (status) {
    1.20              printf("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
    1.21 @@ -251,10 +253,11 @@
    1.22              continue;
    1.23          }
    1.24  
    1.25 +        aspectAdjust = (4.0f / 3.0f) / ((float)state->window_w / state->window_h);
    1.26          glViewport(0, 0, state->window_w, state->window_h);
    1.27          glMatrixMode(GL_PROJECTION);
    1.28          glLoadIdentity();
    1.29 -        glOrthof(-2.0, 2.0, -2.0, 2.0, -20.0, 20.0);
    1.30 +        glOrthof(-2.0, 2.0, -2.0 * aspectAdjust, 2.0 * aspectAdjust, -20.0, 20.0);
    1.31          glMatrixMode(GL_MODELVIEW);
    1.32          glLoadIdentity();
    1.33          glEnable(GL_DEPTH_TEST);
    1.34 @@ -275,7 +278,7 @@
    1.35                  switch (event.window.event) {
    1.36                      case SDL_WINDOWEVENT_RESIZED:
    1.37                          for (i = 0; i < state->num_windows; ++i) {
    1.38 -                            if (event.window.windowID == state->windows[i]) {
    1.39 +                            if (event.window.windowID == SDL_GetWindowID(state->windows[i])) {
    1.40                                  status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
    1.41                                  if (status) {
    1.42                                      printf("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
    1.43 @@ -327,3 +330,5 @@
    1.44  }
    1.45  
    1.46  #endif /* HAVE_OPENGLES */
    1.47 +
    1.48 +/* vi: set ts=4 sw=4 expandtab: */