LaurentGomila/SFML — Issue #116: Rendertexture produces upside down result
Author: Groogy
Created: 2011-10-30 03:02:02+00:00
State: open

It is more like an unexpected behaviour more than a bug but still it blew me back a couple of hours in tracking down the source and it all came down to this.

If you render to a rendertexture and do not call Display before trying to use it, it might be possible for you to get a upside down result. It's not a major bug but it is confusing at the time if you just by accident missed to make the proper call. Having nothing being changed should be the proper behaviour if you ask me. It would also make it easier for the developer to guess what he did wrong.

Here's code for a simple example:

```cpp
#include

int main(int argc, char** argv)
{
sf::RenderWindow window;
window.Create( sf::VideoMode( 800, 600 ), "RenderTexture mirror bug" );

sf::RenderTexture texture;
texture.Create( 800, 600 );

sf::Text text;
text.SetString( "Hello world!" );
texture.Draw( text );
//texture.Display(); // <- If this is run then the proper result is produced.

sf::Sprite textureSprite( texture.GetTexture() );

while( window.IsOpened() == true )
{
window.Clear();
window.Draw( textureSprite );
window.Display();

sf::Event event;
while( window.PollEvent( event ) == true )
{
if( event.Type == sf::Event::Closed )
{
window.Close();
break;
}
}
}
return 0;
}
```

I've compiled and tested this on Windows, MinGW with Debug library and Nvidia card only.