1
General discussions / SFML 2.0 - RenderImage is cleared on first display
« on: August 18, 2010, 06:43:51 pm »
Oh, that was too obvious. Thanks for your help.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
#include <SFML/Graphics.hpp>
int main() {
if (!sf::RenderImage::IsAvailable())
return -1;
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
sf::RenderImage image;
if (!image.Create(500, 500))
return -1;
sf::Sprite sprite(image.GetImage());
//window.Draw(sprite);//Uncomment to make it work as expected
image.Clear(sf::Color::Red);
while (window.IsOpened()) {
window.Clear();
window.Draw(sprite);
window.Display();
}
}