Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug #783
Browse files Browse the repository at this point in the history
Fixed coordinate positioning with OpenGL renderer, and added a test case
  • Loading branch information
slouken committed Sep 19, 2009
1 parent c00f1c7 commit 0ee6f94
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/video/SDL_renderer_gl.c
Expand Up @@ -450,8 +450,8 @@ GL_ActivateRenderer(SDL_Renderer * renderer)
data->glMatrixMode(GL_MODELVIEW);
data->glLoadIdentity();
data->glViewport(0, 0, window->w, window->h);
data->glOrtho(0.0, (GLdouble) window->w, (GLdouble) window->h, 0.0,
0.0, 1.0);
data->glOrtho(-0.5, (GLdouble) window->w-0.5,
(GLdouble) window->h-0.5, -0.5, 0.0, 1.0);
data->updateSize = SDL_FALSE;
}
return 0;
Expand Down
13 changes: 11 additions & 2 deletions test/testsprite2.c
Expand Up @@ -134,10 +134,19 @@ MoveSprites(SDL_WindowID window, SDL_TextureID sprite)
SDL_SetTextureAlphaMod(sprite, (Uint8) current_alpha);
}

/* Move the sprite, bounce at the wall, and draw */
n = 0;
/* Draw a gray background */
SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
SDL_RenderFill(NULL);

/* Draw two red points to make sure they show up correctly */
SDL_SetRenderDrawColor(0xFF, 0x00, 0x00, 0xFF);
SDL_RenderPoint(0, 0);
SDL_RenderPoint(window_w-1, 0);
SDL_RenderPoint(0, window_h-1);
SDL_RenderPoint(window_w-1, window_h-1);

/* Move the sprite, bounce at the wall, and draw */
n = 0;
for (i = 0; i < num_sprites; ++i) {
position = &positions[i];
velocity = &velocities[i];
Expand Down

0 comments on commit 0ee6f94

Please sign in to comment.