Hi,
I just installed Windows 8 and Visual Studio 2012 and am having some problems with SFML 2.0.
In my actual application there's quite a lot of weird graphical artifacts, but I noticed there was a problem with text specifically, so I created a minimal example (from the SFML pong-example code actually) showing it:
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600, 32), "SFML Pong");
// Load the text font
sf::Font font;
if (!font.loadFromFile("resources/sansation.ttf"))
return EXIT_FAILURE;
// Initialize the pause message
sf::Text pauseMessage;
pauseMessage.setFont(font);
pauseMessage.setPosition(20, 20);
pauseMessage.setColor(sf::Color::White);
pauseMessage.setString("Welcome to SFML pong!");
while (window.isOpen())
{
// Handle events
sf::Event event;
while (window.pollEvent(event))
{
// Window closed or escape key pressed: exit
if ((event.type == sf::Event::Closed) ||
((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape)))
{
window.close();
break;
}
}
// Clear the window
window.clear(sf::Color(50, 200, 50));
sf::RectangleShape r(sf::Vector2f(10,10));
r.setPosition(10,10);
window.draw(r);
window.draw(r); // Comment out to fix text
window.draw(pauseMessage);
// Display things on screen
window.display();
}
return EXIT_SUCCESS;
}
With the second call to draw the RectangleShape commented out, I get this as expected:
But commenting it in yields this:
I've tried a few things to troubleshoot this:
- It does not matter if I'm drawing the same object twice, or two different ones.
- Calling draw on the text again (with another colour or in another location so it doesn't blend in) shows correctly.
- The colour of the rectangle does not matter -- the "text-boxes" are the text's colour.
- Looking at draw(...) in RenderTarget and what it calls, I can't see any state that could've been kept by SFML between drawing the rectangle and text.
This leaves me thinking there must be some error in the graphics driver which doesn't operate OpenGL's state-machine correctly so the state from drawing the second rectangle somehow persists to the next draw call. To further test this, I tried running an old build of my application built by VS2010 in Windows 7 (where it worked fine) and it also shows artifacts there. Other OpenGL-applications works fine though (tested Quake 3 and an OpenGL 3.3-application (i.e. not fixed function pipeline)).
Any suggestions what I could do? Seeing as other OpenGL-applications work fine, I'm 1) not entirely confident it's a problem with OpenGL, and 2) even if it is it seems like a very localized problem so there's probably little hope for a fix any time soon.
I have a Radeon HD6950 and am running the latest driver (Catalyst 12.10).
Edit: Oh, and BTW, this is with the newest snapshot of SFML 2.0 (044eb858). I also tested one from around the start of May since that seems to be when the RC was built (as the working-in-Win7-but-not-Win8-VS2010-build used it) . Same problem.