From 6f843b902d307c9dbe1bbaf4131730a7649fb077 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 12 Aug 2017 12:59:22 -0700 Subject: [PATCH] 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 | 2 +- src/render/opengles/SDL_render_gles.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index 9ad2eb720..3e0340fee 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -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); diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c index 3eed9e4c9..13e15e5cb 100644 --- a/src/render/opengles/SDL_render_gles.c +++ b/src/render/opengles/SDL_render_gles.c @@ -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;