Hello,
I'm new to SFML and I'm trying to draw sprites with transparency (mostly to draw things on top of other things).
From the tutorials and forum topics I've browsed, I understand that PNG texture transparency should work without doing anything special.
Here is what I've done (slightly modified base tuto):
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::Texture myTexture;
myTexture.loadFromFile("./textures.png");
sf::Sprite mySprite;
mySprite.setTexture(myTexture);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear(sf::Color::Blue);
window.draw(mySprite);
window.display();
}
return 0;
}
And when I run it, at the places where my texture is transparent I see a white rectangle instead of the blue background. I'd like the background (or anything drawn before) to be displayed through the transparent parts of the image. I have tried various PNG images with no success.
Did I do something wrong or miss anything? Is this a bug/config problem on my end?
I'm running the git version of SFML compiled by hand on debian on a virtual machine (3d acceleration working, no direct rendering) and with an ATI radeon 6950.
Any help is welcome
EDIT: my problem was solved (see my last post below) and was VirtualBox-related.