Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [SOLVED]sf::Text Garbled When Objects are Drawn Underneath  (Read 1684 times)

0 Members and 2 Guests are viewing this topic.

Tacostamp

  • Newbie
  • *
  • Posts: 7
    • View Profile
[SOLVED]sf::Text Garbled When Objects are Drawn Underneath
« on: December 05, 2012, 05:07:11 am »
So, I looked around but couldn't find a similar thread. This may be an issue with my hardware...

OS: Windows 7
GPU: Radeon HD 5800
Static version of SFML 2.0

Description: So, as you can see from the code, I draw two Rectangle objects at 0,0. Then, I try and layer a sf::Text object on top ... this makes the text completely garbled. If I only draw ONE of those RectangleShapes, the text shows up fine, so this is only an issue when two or more RectangleShapes are drawn at this location.

You should be able to paste this code right into a main file with just the SFML library as a header.
sf::RectangleShape back;
sf::RectangleShape front;
sf::Font font;

int main()
{
        sf::RenderWindow window(sf::VideoMode(1600, 900), "Tile Game"); //Set up the main Window
        font.loadFromFile("arial.ttf");
        while(window.isOpen()){

                back.setFillColor(sf::Color::Blue);
                back.setPosition(0, 0);
                back.setSize(sf::Vector2f(400,400));
                window.draw(back); //draw one large Rectangle

                front.setFillColor(sf::Color::Red);
                front.setPosition(0, 0);
                front.setSize(sf::Vector2f(200,200));
                window.draw(front); //draw a smaller rectangle

                sf::Text text("test", font, 25);

                window.draw(text); //draw some text

                window.display();
        }
    return 0;
}
 

Notice, if you comment out one of the window.draw() from a Rectangle, the font shows up. Please see the attachment for a picture of what the font is showing up as on my screen.

[attachment deleted by admin]
« Last Edit: December 05, 2012, 05:33:23 am by Tacostamp »

cire

  • Full Member
  • ***
  • Posts: 138
    • View Profile
Re: sf::Text Garbled When Objects are Drawn Underneath
« Reply #1 on: December 05, 2012, 05:16:04 am »
http://en.sfml-dev.org/forums/index.php?topic=9561.0

The search function seems a bit reluctant lately.

Tacostamp

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: sf::Text Garbled When Objects are Drawn Underneath
« Reply #2 on: December 05, 2012, 05:32:44 am »
Hey .. thanks! Updating the drivers to the new Catalyst beta release of 12.11 worked for me.

What a strange bug ... talk about frustrating!

 

anything