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

Commit

Permalink
Fixed bug 1844 - glScissor calls are wrong - Patch attached
Browse files Browse the repository at this point in the history
Martin Gerhardy

the coordinate system from sdl is not correctly transformed to the coordinate system of opengl. glScissor expects them to be a little bit different. Attached is a patch that fixes this
  • Loading branch information
philippwiesemann committed May 12, 2013
1 parent 5561d2e commit 0f5d772
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/render/opengl/SDL_render_gl.c
Expand Up @@ -794,7 +794,8 @@ GL_UpdateClipRect(SDL_Renderer * renderer)

if (!SDL_RectEmpty(rect)) {
data->glEnable(GL_SCISSOR_TEST);
data->glScissor(rect->x, rect->h - rect->y, rect->w, rect->h);
int lowerLeft = renderer->viewport.h - rect->y - rect->h;
data->glScissor(rect->x, lowerLeft, rect->w, rect->h);
} else {
data->glDisable(GL_SCISSOR_TEST);
}
Expand Down
3 changes: 2 additions & 1 deletion src/render/opengles/SDL_render_gles.c
Expand Up @@ -645,7 +645,8 @@ GLES_UpdateClipRect(SDL_Renderer * renderer)

if (!SDL_RectEmpty(rect)) {
data->glEnable(GL_SCISSOR_TEST);
data->glScissor(rect->x, rect->h - rect->y, rect->w, rect->h);
int lowerLeft = renderer->viewport.h - rect->y - rect->h;
data->glScissor(rect->x, lowerLeft, rect->w, rect->h);
} else {
data->glDisable(GL_SCISSOR_TEST);
}
Expand Down
3 changes: 2 additions & 1 deletion src/render/opengles2/SDL_render_gles2.c
Expand Up @@ -288,7 +288,8 @@ GLES2_UpdateClipRect(SDL_Renderer * renderer)

if (!SDL_RectEmpty(rect)) {
rdata->glEnable(GL_SCISSOR_TEST);
rdata->glScissor(rect->x, rect->h - rect->y, rect->w, rect->h);
int lowerLeft = renderer->viewport.h - rect->y - rect->h;
rdata->glScissor(rect->x, lowerLeft, rect->w, rect->h);
} else {
rdata->glDisable(GL_SCISSOR_TEST);
}
Expand Down

0 comments on commit 0f5d772

Please sign in to comment.