Hello,
I'm looking to draw pixels in real-time with SFML, and I'm hesitating between sf::Image and sf::RenderTexture. What happens internally with these classes? What's the best practice between this,
sf::Image image;
image.create(1920, 1080);
image.setPixel(100, 200, sf::Color::Red);
sf::Texture texture;
texture.loadFromImage(image);
sf::Sprite sprite(texture);
window.clear();
window.draw(sprite);
window.display();
and that ?
sf::RenderTexture renderTexture;
renderTexture.create(1920, 1080);
renderTexture.clear();
sf::Vertex vertices[] = {sf::Vertex(sf::Vector2f(100, 200), sf::Color::Red)};
renderTexture.draw(vertices, 1, sf::Points);
renderTexture.display();
sf::Sprite sprite(renderTexture.getTexture());
window.clear();
window.draw(sprite);
window.display();