SFML community forums
Help => Graphics => Topic started by: fsteff on December 01, 2011, 06:17:35 pm
-
I have following problem:
If I load and want to display a sprite, it is fully white(no image)
I am using SFML 2.0 (built it last week)
here the code:
sf::Texture Hintergrundbild;
if (!Hintergrundbild.LoadFromFile("data/Hintergrund.bmp"))
MessageBox(0,"WORLD::CreateWorld #2\nKonnte Hintergrund.bmp nicht laden!",0,0);
Hintergrund = new sf::Sprite(Hintergrundbild);
LoadFormFile returns true
Later I draw it...
Fenster->Draw(*Hintergrund);
"Fenster" is a sf::RenderWindow
I am able to move it around, but it doesn´t display the texture.
-
Is the Hintergrundbild texture still alive when you draw the sprite?
-
no... has it to be? if yes, there is the problem...
-
Of course it has to be, the sprite doesn't have its own copy of the texture; it just uses it ;)
-
thx, there was the problem, now it works fine :D