Skip to content

Commit

Permalink
Fixed bug 3243 - SDL_SetRenderDrawColor() behaves wrong with RGBA=0
Browse files Browse the repository at this point in the history
Simon Hug

The bug is in the GL_ResetState and GLES_ResetState functions which get called after a new GL context is created. These functions set the cached current color to transparent black, but the GL specification says the initial color is opaque white.

The attached patch changes the values to 0xffffffff to reflect the initial state of the current color. Should the ResetState functions get called anywhere else in the future, this probably has to call the GL functions itself to ensure that the colors match.
  • Loading branch information
slouken committed Aug 12, 2017
1 parent 47c2c7d commit 6f843b9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/render/opengl/SDL_render_gl.c
Expand Up @@ -320,7 +320,7 @@ GL_ResetState(SDL_Renderer *renderer)
}

data->current.shader = SHADER_NONE;
data->current.color = 0;
data->current.color = 0xffffffff;
data->current.blendMode = -1;

data->glDisable(GL_DEPTH_TEST);
Expand Down
2 changes: 1 addition & 1 deletion src/render/opengles/SDL_render_gles.c
Expand Up @@ -261,7 +261,7 @@ GLES_ResetState(SDL_Renderer *renderer)
GLES_ActivateRenderer(renderer);
}

data->current.color = 0;
data->current.color = 0xffffffff;
data->current.blendMode = -1;
data->current.tex_coords = SDL_FALSE;

Expand Down

0 comments on commit 6f843b9

Please sign in to comment.