Hello everyone.
I am using SFML 2.0 and I noticed that sf::RenderTexture behaves strangely in some situations.
In my game, I use RenderTexture to avoid redrawing all the tiles on the screen each frame. I draw the whole screen + some extra tiles to RenderTexture once, then I get sprite from this RenderTexture and draw it to the RenderWindow to show my level to the player as long as his/her character stays in the bounds of RenderTexture. If he crosses the bounds, I am just adding some tiles to the RenderTexture and displaying the new picture on the screen. Works like a charm.
Though not everywhere. I tested this on my desktop, which has nVidia GPU, and everything is displayed just like I expect. Recently, I tried launching my game on my laptop, and what I see there when I start the game is black screen only. Laptop has an integrated Intel video card.
I found a way to show minimal code pretty fast.
I took the entire code of pong example, and after this line:
sf::RenderWindow window(sf::VideoMode(800, 600, 32), "SFML Pong");
I just added
sf::RenderTexture texture;
texture.Create(800,600);
You may provide Create() with any arbitrary numbers.
I am not drawing this texture, not using it anywhere in this example, just using Create(), and this already shows the result. On my desktop, I can see the game, but on the laptop, only the "You lost!" text appears a few seconds after launching the game.
Also, I use RenderWindow::Create to switch video mode from my game's main menu. This works good on my desktop; on the laptop the game just silently quits on Create(), though this problem is not as critical as the previous one.
Is that expected? Or am I doing something wrong?
Both computers run Ubuntu 11.04. Thanks in advance.