sdl 2 - Blending textures in SDl2 -


i have 2 textures, both of them created sdl_textureaccess_streaming flag. have blend mode set sdl_blendmode_blend. i'm updating both of them in each frame 2 different surfaces. 1 of them has alpha values equal 0 (mostly transparent). when put 1 of textures on top of another, blending doesn't happen.

for example - 1 surface going have rgba values = 255, 255, 255, 0 pixels. when update texture it, , put same texture on top of image black pixels.

how accomplish blending on 2 textures in such way pixels 0 alpha treated transparent instead of being turned black pixels? happening? textures ignore alpha values?

this has formulae blending modes:

sdl.org: sdl_blendmode

and has visual examples of each of ways of combining 2 textures via blending (for opengl, results should same few modes sdl implements):

stackexchange gamedev: opengl blending gui textures: answer 1

sdl_blendmode_blend has (1-alpha) term in it, which, if alpha near 0, near 1, causing opacity you're expecting transparency. depends on you're using src , dest, also.

(nb: i'd post comment, don't have reputation yet.)


Comments