Don't know if it's a bug, but if I don't call 'display' function - render texture draws upside down.
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
int main() {
sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
sf::Event event;
sf::Font font;
sf::Text text;
sf::RectangleShape shape;
sf::Sprite spr;
sf::RenderTexture tex;
font.loadFromFile("font.ttf");
text.setFont(font);
text.setString("HELLO");
text.setCharacterSize(200);
text.setFillColor(sf::Color::Black);
shape.setSize(sf::Vector2f(100,100));
shape.setPosition(100, 300);
shape.setFillColor(sf::Color::Black);
tex.create(800,600);
tex.setActive(true);
tex.clear(sf::Color::White);
tex.draw(text);
tex.draw(shape);
//tex.display();
spr.setTexture(tex.getTexture());
while (window.isOpen()) {
while (window.pollEvent(event)) if (event.type == sf::Event::Closed) window.close();
window.clear(sf::Color::White);
window.draw(spr);
window.display();
}
return 0;
}
1.png - with 'display' call
2.png - without