The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Trying to combine two mask textures - How do I add alpha?
Danni111111


Joined: 30 Aug 2015
Posts: 5
Hi,

I'm trying to combine two mask textures together before applying a texture to the combination. However, I can't seem to find a function which would allow me to do this.

What I want to do: dstA = dstA + srcA.

However, SDL_SetTextureBlendMode only allows dstA = srcA + (dstA * (1-srcA)) as a way to change the alpha.

Anyone have any suggestions?

Thanks in advance!
Danni111111


Joined: 30 Aug 2015
Posts: 5
Hi all,

Still having difficulty with this problem.

To give some context - it is for placing semi transparent water tile textures (i.e. Water where you can see the bottom)

The two alphas I want to add together are used to show the depth of water, and the slope. Both can be varied. Idea is that if a water tile has a depth of 5 and a slope of 2, it will find these respective masks, add their alphas and apply it to the water texture, and hey pronto I have a water texture that is 5 units deep with a slope of 2.

The reason I can't use blend mode is that tiles with slopes will not be seamless - A tile with depth 2 and slope 2 next to a tile with depth 4 slope 2 will not show a continuous gradient of depth - instead it will be disjointed at the boundaries.

Any help will be greatly appreciated!