Hi everyone.
I'm using SFML compiled from source from the feature/xcb branch.
When trying to render text in a virtual machine running Ubuntu 14.04 (both x86 and x86_64), my code gives me blocky text:
int main()
{
// Load a font for text rendering
sf::Font font;
if(!font.loadFromFile("resources/sansation.ttf"))
return EXIT_FAILURE;
// Create a text object using the font we've just loaded
sf::Text text;
text.setFont(font);
text.setCharacterSize(16);
text.setColor(sf::Color::White);
text.setPosition(0.f, 0.f);
text.setString(
"SFMLSFMLSFML"
);
// Create the main window
sf::RenderWindow window(sf::VideoMode(640, 64), "SFML");
// Start the game loop
while (window.isOpen())
{
// Process events
sf::Event event;
while (window.pollEvent(event))
{
// Close window: exit
if (event.type == sf::Event::Closed)
window.close();
// Escape key: exit
if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape))
window.close();
}
// Clear the window of previously drawn content
window.clear();
// Draw our text
window.draw(text);
// Finally, display the rendered frame on screen
window.display();
}
return EXIT_SUCCESS;
}
Here's an image:
(http://i.imgur.com/JucmzKJ.png?1)
This is weird because I'm using exactly the same font as the OpenGL example, and the OpenGL example's text renders just fine (http://i.imgur.com/l6xEmHr.png?1)
The same code works just fine on Windows (8.1 x86_64)
Any ideas/feedback/help is appreciated.
Thanks,
Aster