I'm finally trying sfml2.
By accident, I got a sprite being drawn in white instead of it's original image.
I reproduced it this way:
#include <SFML\Graphics.hpp>
int main(){
sf::RenderWindow App(sf::VideoMode(200, 200, 32), "press key for white picture!");
sf::Image img;
while (App.IsOpened()){
sf::Event Event;
while (App.GetEvent(Event)){
if (Event.Type == sf::Event::Closed) App.Close();
if (Event.Type == sf::Event::KeyPressed){
img.LoadFromFile("paddle_right.png");
}
}
App.Clear();
App.Draw(sf::Sprite(img));
App.Display();
}
return EXIT_SUCCESS;
}
The image is from the pong example.
The same code works with SFML 1.6.
Calling img.Bind() after loading solves it. Am I supposed to explicitly call Bind?