Closed Matias-Barrios closed 5 years ago
Hi @Matias-Barrios, could you please create a very minimal example that demonstrate this issue? That would really help me in figuring out the issue. Thanks!
Hi @veeableful . I have created this small repo which only draws a background and a block :+1: https://github.com/Matias-Barrios/transparency_bug
You can clone and play around with these two lines : https://github.com/Matias-Barrios/transparency_bug/blob/master/main.go#L32-L33
You will see that although the transparency of the block changes the background is not affected. Please let me know if this is minimalist enough
Hi @Matias-Barrios, it seems like the texture needs to set a blend mode via textureImg.SetBlendMode(sdl.BLENDMODE_BLEND)
so any image can be made translucent. Otherwise, it seems like the image needs to be saved with RGBA color type (based on quick investigation using fotoforensics.com on the images).
Oh and thank you very much for the mini example! That was super helpful! I think if I tried to recreate the image, I wouldn't have had the same problem as the image I created for assisting with the investigation already had RGBA color type :smiley:
@veeableful understood. Thanks for digging into this. I'll try to add the changes and contact you back in case of issues. Awesome! :)
I have a weird issue when trying to add alpha to the background of my game. I have this function :
The problem is, it seems to make textures transparent only when they are small (??). for instance I can make each small block in my game transparent but it does not seem to affect the background, although both are drawn in the same way.