SFML community forums

Help => Graphics => Topic started by: fsteff on December 01, 2011, 06:17:35 pm

Title: displays Sprite white[solved]
Post 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:
Code: [Select]
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...
Code: [Select]
Fenster->Draw(*Hintergrund);

"Fenster" is a sf::RenderWindow

I am able to move it around, but it doesn´t display the texture.
Title: displays Sprite white[solved]
Post by: Laurent on December 01, 2011, 06:34:56 pm
Is the Hintergrundbild texture still alive when you draw the sprite?
Title: displays Sprite white[solved]
Post by: fsteff on December 01, 2011, 06:43:37 pm
no... has it to be? if yes, there is the problem...
Title: displays Sprite white[solved]
Post by: Laurent on December 01, 2011, 06:44:16 pm
Of course it has to be, the sprite doesn't have its own copy of the texture; it just uses it ;)
Title: displays Sprite white[solved]
Post by: fsteff on December 01, 2011, 06:47:28 pm
thx, there was the problem, now it works fine  :D