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 - SDL_SetTextureAlphaMod doesn't work on textures without a image-side alpha channel
Summary: SDL_SetTextureAlphaMod doesn't work on textures without a image-side alpha ch...
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.1
Hardware: x86_64 Windows 7
: P2 major
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-18 07:13 UTC by c4577894
Modified: 2017-08-14 10:33 UTC (History)
1 user (show)

See Also:


Attachments

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