Hey,
You apply the blending twice. Once when you render it to the render texture and once when you render it to the window.
How comes the blending is applied twice? The shape
white that I labeled "weird blending" is only drawn once!
If I'm not mistaken, when I draw the shape
white drawn on the RT, the result is stored inside the RT.
So, I'd expect drawing this RT to a render window would behave the same as drawing a PNG with transparency.
keep a fully opaque alpha channel on the RT (-> custom blending).
This alone makes a difference. If I clear the RT with an opaque color (instead of sf::Color::Transparent), I got the expected result (the two squares look the same).
But I think I have a better understanding of my issue now: I saved the RT to png file. (see attachement).
We can see that rendering rgba(255, 255, 255, 128) on sf::Color::Transparent results in rgba(128, 128, 128, 128), because sf::Color::Transparent is defined as "black" rgba(0, 0, 0, 0).
Whereas I was expecting the result to be rgba(255, 255, 255, 128).
So, is this behavior of sf::BlendAlpha + sf::Color::Transparent intended?
Thanks,