Fixed bug 3243 - SDL_SetRenderDrawColor() behaves wrong with RGBA=0
authorSam Lantinga
Sat, 12 Aug 2017 12:59:22 -0700
changeset 1124354f46b251fe1
parent 11242 70ae86f64702
child 11244 cbc9323b7167
Fixed bug 3243 - SDL_SetRenderDrawColor() behaves wrong with RGBA=0

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.
src/render/opengl/SDL_render_gl.c
src/render/opengles/SDL_render_gles.c
     1.1 --- a/src/render/opengl/SDL_render_gl.c	Sat Aug 12 12:56:28 2017 -0700
     1.2 +++ b/src/render/opengl/SDL_render_gl.c	Sat Aug 12 12:59:22 2017 -0700
     1.3 @@ -320,7 +320,7 @@
     1.4      }
     1.5  
     1.6      data->current.shader = SHADER_NONE;
     1.7 -    data->current.color = 0;
     1.8 +    data->current.color = 0xffffffff;
     1.9      data->current.blendMode = -1;
    1.10  
    1.11      data->glDisable(GL_DEPTH_TEST);
     2.1 --- a/src/render/opengles/SDL_render_gles.c	Sat Aug 12 12:56:28 2017 -0700
     2.2 +++ b/src/render/opengles/SDL_render_gles.c	Sat Aug 12 12:59:22 2017 -0700
     2.3 @@ -261,7 +261,7 @@
     2.4          GLES_ActivateRenderer(renderer);
     2.5      }
     2.6  
     2.7 -    data->current.color = 0;
     2.8 +    data->current.color = 0xffffffff;
     2.9      data->current.blendMode = -1;
    2.10      data->current.tex_coords = SDL_FALSE;
    2.11