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 2352

Summary: SDL_SetTextureAlphaMod doesn't work on textures without a image-side alpha channel
Product: SDL Reporter: c4577894
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: adam
Version: 2.0.1   
Hardware: x86_64   
OS: Windows 7   

Description c4577894 2014-01-18 07:13:21 UTC
Using SDL_SetTextureAlphaMod on a texture that doesn't have an alpha channel will do nothing, it doesn't return anything you can check with SDL_GetError either.

Tried it with .jpgs, .bmps and .pngs, none of them work.

Same result on DirectX, OpenGL and Software renderer.
Comment 1 Adam M. 2014-05-11 01:36:21 UTC
That's really unfortunate. It seems to me that one of the main points of SDL_SetTextureAlphaMod is to allow alpha blending surfaces that don't have their own alpha channel.
Comment 2 Adam M. 2014-05-11 19:54:01 UTC
I haven't been able to reproduce this behavior in the software renderer (using 16-bit textures w/o an alpha channel).

You have to set the texture blend mode before it will work, in addition to setting the texture alpha mod:

SDL_SetTextureBlendMode(hTexture, SDL_BLENDMODE_BLEND);

Does that help?
Comment 3 Sam Lantinga 2017-08-14 10:33:47 UTC
Adam, I think you're right, SDL_SetTextureBlendMode() was missing.