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 - Texture color modulation doesn't work with active NONE blend mode (opengl and opengles)
Summary: Texture color modulation doesn't work with active NONE blend mode (opengl and...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
: 2317 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-06-12 19:17 UTC by Simon Hug
Modified: 2016-10-01 18:05 UTC (History)
1 user (show)

See Also:


Attachments
Test case for the texture color modulation with an active NONE blend mode. (2.72 KB, text/x-csrc)
2016-06-12 19:17 UTC, Simon Hug
Details
Patch that fixes the texture color modulation when the NONE mode is active with the opengl en opengles renderers. (2.72 KB, patch)
2016-06-12 19:20 UTC, Simon Hug
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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. ***