SFML community forums
Help => Graphics => Topic started by: Tank on October 28, 2009, 03:32:29 pm
-
Hey,
I've just discovered a problem I can't solve. I'm drawing some sf::Strings onto an sf::RenderImage that got initialized with black full transparent pixels.
Now pixels of the strings having an alpha values are -- because it's alpha blending ;) -- blended with the RGBA = 0, 0, 0, 0 pixels of the sf::RenderImage, resulting in not displaying those pixels at all.
Is there any solution available? I want the sf::RenderImage to be transparent except stuff that I draw on it.
-
Actually they should be displayed. The blending equations gives this:
a = src.alpha * src.alpha + dst.alpha * (1 - src.alpha)
So the output alpha should be the square of src.alpha (*), not 0.
(*) this is still an error, but the only solution that I found involves using a function which is only available in OpenGL >= 1.4.
-
Okay true, I just didn't see them because they were mixed with those black pixels. When I changed the RenderImage's background to RGBA = 255, 0, 255, 0, I was able to see that.
What I want is to apply a drawable to the RenderImage when the underlying pixel alpha value is 0. Is this anyhow possible?
I could use sf::Blend::None, but then alpha pixels of the source images are not drawn corretly. Any ideas? ;)
Edit:
Using sf::Blend::None for the sprite displaying the RenderImage solved my problem.
-
What I want is to apply a drawable to the RenderImage when the underlying pixel alpha value is 0. Is this anyhow possible?
So far, no. But it has nothing to do with the underlying pixels, the issue is related to how the source alpha is treated.
I could use sf::Blend::None, but then alpha pixels of the source images are not drawn corretly
Really? Using Blend::None should do a raw copy of the source pixels and completely overwrite the original image.
Edit:
Using sf::Blend::None for the sprite displaying the RenderImage solved my problem.
Ok, good :)
Forget my previous question.