Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Why does sf::RenderTexture rotate texture?  (Read 2418 times)

0 Members and 1 Guest are viewing this topic.

Krofna

  • Newbie
  • *
  • Posts: 42
    • View Profile
    • Email
Why does sf::RenderTexture rotate texture?
« on: December 29, 2011, 01:33:31 pm »
For some weird reason, when I load tile map into sf::RenderTexture, and then display it like this:

Code: [Select]
void Map::ShowMap()
{
    sf::Sprite sprite(RenderMapTexture.GetTexture());//RenderMapTexture is object of sf::RenderTexture
    MapWindow->Draw(sprite);//MapWindow is object of sf::RenderWindow
    //Display is called in game loop right after calling Map::ShowMap();
}


Texture showed gets rotated for 180 degrees. I tried rotating sprite to counter that, but then screen goes black.

This is how it looks like:

http://img854.imageshack.us/img854/6717/rotirano.png

One thing is sure tho; my tiles arent rotated :D

Any idea why this happens?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Why does sf::RenderTexture rotate texture?
« Reply #1 on: December 29, 2011, 01:34:42 pm »
Maybe you forgot to call Display() on your RenderMapTexture after drawing.
Laurent Gomila - SFML developer

Krofna

  • Newbie
  • *
  • Posts: 42
    • View Profile
    • Email
Why does sf::RenderTexture rotate texture?
« Reply #2 on: December 29, 2011, 01:45:15 pm »
Ah yes, that seem to fix it. Thanks.