Hi,
I am working on making an in-game terminal/debug console for my engine, and I wanted to draw all the text once to a renderTexture, then I'll just scroll the sprite it is linked to up, so I don't actually need to render the text every frame.
I have noticed however, that when I directly draw text on my main renderWindow, it looks perfect, but if I draw the text on a renderTexture, and then draw the sprite linked to the renderTexture to the renderWindow, it looks ...broken. I can't really find a better word to describe it, but I have attached a screenshot of what I am talking about.
The top 3 lines are drawn to the renderWindow, and look good, the bottom ones are on the renderTexture and look the way it shows.
EDIT: I uploaded a bigger pic without compression, that better shows this:
In case the direct image link changes, and the image doesn't show, try this:
http://postimage.org/image/7ss9oaj7j/Here is a minimal and complete (and super sloppy) example that reproduces the output in the screenshot:
(I have attached the font I used)
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow App;
sf::VideoMode VM;
VM.width = 800; VM.height = 400;
sf::RenderTexture rTexture; sf::Sprite rSprite;
rTexture.create(800,400);
rSprite.setTexture(rTexture.getTexture());
sf::Font ProFont;
ProFont.loadFromFile("profontwindows.ttf");
sf::Text Text;
Text.setFont(ProFont);
Text.setCharacterSize(9);
Text.setString("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \n exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat \n nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
App.create(VM, "sfml");
App.clear(sf::Color(128,128,128));
App.draw(Text);
Text.move(0,50);
rTexture.draw(Text);
rTexture.display();
App.draw(rSprite);
App.display();
while (1) {}
return 0;
}
Laurent, if you are reading this, what do you think is causing this? Is there some setting I would need to apply to the renderTexture? I have tried with smooth on and off, and saw no difference.
This "graininess" becomes less visible the bigger the characterSize is, but I would need this font as small as it is now, I want the most possible text displayed on the screen (this is the font and size I use in my IDE as well).
Thank You in advance!
(I am using SFML 2.0, the snapshot I downloaded on 08-03-12 (3 days ago), in Win7)
[attachment deleted by admin]