Fixed bug #783
authorSam Lantinga <slouken@libsdl.org>
Sat, 19 Sep 2009 05:12:26 +0000
changeset 32648fe0806637df
parent 3263 924b486541dc
child 3265 8f534bf37bef
Fixed bug #783

Fixed coordinate positioning with OpenGL renderer, and added a test case
src/video/SDL_renderer_gl.c
test/testsprite2.c
     1.1 --- a/src/video/SDL_renderer_gl.c	Sat Sep 19 04:47:36 2009 +0000
     1.2 +++ b/src/video/SDL_renderer_gl.c	Sat Sep 19 05:12:26 2009 +0000
     1.3 @@ -450,8 +450,8 @@
     1.4          data->glMatrixMode(GL_MODELVIEW);
     1.5          data->glLoadIdentity();
     1.6          data->glViewport(0, 0, window->w, window->h);
     1.7 -        data->glOrtho(0.0, (GLdouble) window->w, (GLdouble) window->h, 0.0,
     1.8 -                      0.0, 1.0);
     1.9 +        data->glOrtho(-0.5, (GLdouble) window->w-0.5,
    1.10 +                      (GLdouble) window->h-0.5, -0.5, 0.0, 1.0);
    1.11          data->updateSize = SDL_FALSE;
    1.12      }
    1.13      return 0;
     2.1 --- a/test/testsprite2.c	Sat Sep 19 04:47:36 2009 +0000
     2.2 +++ b/test/testsprite2.c	Sat Sep 19 05:12:26 2009 +0000
     2.3 @@ -134,10 +134,19 @@
     2.4          SDL_SetTextureAlphaMod(sprite, (Uint8) current_alpha);
     2.5      }
     2.6  
     2.7 +    /* Draw a gray background */
     2.8 +    SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
     2.9 +    SDL_RenderFill(NULL);
    2.10 +
    2.11 +    /* Draw two red points to make sure they show up correctly */
    2.12 +    SDL_SetRenderDrawColor(0xFF, 0x00, 0x00, 0xFF);
    2.13 +    SDL_RenderPoint(0, 0);
    2.14 +    SDL_RenderPoint(window_w-1, 0);
    2.15 +    SDL_RenderPoint(0, window_h-1);
    2.16 +    SDL_RenderPoint(window_w-1, window_h-1);
    2.17 +
    2.18      /* Move the sprite, bounce at the wall, and draw */
    2.19      n = 0;
    2.20 -    SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
    2.21 -    SDL_RenderFill(NULL);
    2.22      for (i = 0; i < num_sprites; ++i) {
    2.23          position = &positions[i];
    2.24          velocity = &velocities[i];