Hello!
Raised two questions on the same topic
Here is the code
#include <SFML/Graphics.hpp>
int main()
{
sf::VideoMode VMode(800, 600, 32);
sf::RenderWindow Window(VMode, "SFML 2", sf::Style::Close);
sf::RenderTexture texture;
if (!texture.create(500, 500))
return -1;
sf::Text text;
text.setString("TEST");
text.setPosition(0.0f, 0.0f);
text.setColor(sf::Color(255, 0, 0));
sf::Texture texture_img;
texture_img.loadFromFile("image.png");
sf::Sprite sprite_image;
sprite_image.setTexture(texture_img);
while(Window.isOpen())
{
sf::Event Event;
while(Window.pollEvent(Event))
{
switch(Event.type)
{
case sf::Event::Closed:
Window.close();
break;
case sf::Event::KeyPressed:
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
Window.close();
break;
default:
break;
}
}
texture.clear(sf::Color::Blue);
texture.draw(text);
texture.draw(sprite_image);
// texture.display();
Window.clear(sf::Color(128, 128, 128));
sf::Sprite sprite(texture.getTexture());
Window.draw(sprite);
Window.display();
}
return 0;
}
1. Why texture turns upside down, and what you can do
2. When the string / / texture.display (); longer displayed texture that I do not?