We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3361

Summary: Texture color modulation doesn't work with active NONE blend mode (opengl and opengles)
Product: SDL Reporter: Simon Hug <chli.hug>
Component: renderAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: gindar
Version: HG 2.0   
Hardware: All   
OS: All   
Attachments: Test case for the texture color modulation with an active NONE blend mode.
Patch that fixes the texture color modulation when the NONE mode is active with the opengl en opengles renderers.

Description Simon Hug 2016-06-12 19:17:44 UTC
Created attachment 2493 [details]
Test case for the texture color modulation with an active NONE blend mode.

The GL_SetBlendMode and GLES_SetBlendMode functions of the opengl and opengles renderers call the glTexEnvf to set the texture env mode to either GL_MODULATE (the default) or GL_REPLACE for the NONE blend mode. Using GL_REPLACE disables color and alpha modulation for textures.

These glTexEnv calls were put in the SetBlendMode function back in 2006 [1], but there the NONE code still used the GL_DECAL mode. The GL_REPLACE mode came in 2008 [2]. I'm a bit confused why that wasn't always GL_MODULATE and a bit surprised nobody reported that yet (unless I missed it). I guess only a few use the gles renderer and the newish shaders mask the issue.

Attached is a test case that reproduces the issue. Pass opengl or opengles as the first argument to the program to select the renderer.

In the next comment is a patch that fixes the issue.

[1] https://hg.libsdl.org/SDL/rev/4905cac7a4bd
[2] https://hg.libsdl.org/SDL/rev/dc4523c7c22d
Comment 1 Simon Hug 2016-06-12 19:20:35 UTC
Created attachment 2494 [details]
Patch that fixes the texture color modulation when the NONE mode is active with the opengl en opengles renderers.

The attached patch removes the calls to glTexEnvf in the GL_SetBlendMode and GLES_SetBlendMode functions. Since the default is GL_MODULATE, no mode change is necessary.
Comment 2 Simon Hug 2016-06-12 19:32:02 UTC
Agh, I'm bad at spotting these. Bug 2317 is probably the same issue.
Comment 3 Sam Lantinga 2016-10-01 18:05:34 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/48b40c223503
Comment 4 Sam Lantinga 2016-10-01 18:05:55 UTC
*** Bug 2317 has been marked as a duplicate of this bug. ***