SFML community forums

Help => Graphics => Topic started by: adrian17 on August 22, 2013, 10:34:40 pm

Title: Texture rendering extremely slow on a specific computer
Post by: adrian17 on August 22, 2013, 10:34:40 pm
I've recently started learning SFML and I'm really happy with it myself. But, one of my friends reported that on his (pretty old) computer my programs are virtually unusable, with 5 frames per second (while on just a bit newer computers it ran at 200+ FPS).

That's the small program I've used to check which causes it:
#include <SFML/Graphics.hpp>
#include <sstream>
int main(){
    sf::RenderWindow window(sf::VideoMode(800, 600), "");

    sf::Texture texture; texture.loadFromFile("a.PNG");
    sf::Sprite sprite(texture);

    sf::Clock clock; float dt;

    float square_x_position=0;
    sf::RectangleShape rect(sf::Vector2f{100, 100});

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event)) {if (event.type == sf::Event::Closed) window.close();}
        /*      FPS counter     */
        dt = clock.getElapsedTime().asSeconds();
        clock.restart();
        std::ostringstream fps_counter;
        fps_counter << 1/dt;
        window.setTitle(fps_counter.str());

        rect.setPosition(square_x_position++, 100);

        window.clear();
        window.draw(sprite);
        window.draw(rect);
        window.display();
    }
    return 0;
}

This program, which only rendered a 800x600 graphic and a moving square, ran at around 3-5FPS. When I removed the sprite/texture drawing part (and left only the screen clearing and drawing the rect), it jumped to 150-200FPS, still slower than I think it should be but at least usable.

May the main culprit here be the old video card? Radeon 9250 supports OGL 1.3 and DX 8.1 so it's pretty old, but it can run some other games much, much better than the computer which was able to run the sample program without problems. Is it simply an unavoidable compatibility issue?
Title: Re: Texture rendering extremely slow on a specific computer
Post by: Nexus on August 22, 2013, 10:50:54 pm
Have you tried updating the graphics drivers?
Title: Re: Texture rendering extremely slow on a specific computer
Post by: adrian17 on August 23, 2013, 11:17:14 am
Vista has automatically downloaded the 6.14 version AMD's driver when it was installed only half a year ago, so I guess it's the most recent version.
Title: Re: Texture rendering extremely slow on a specific computer
Post by: Nexus on August 23, 2013, 11:32:40 am
Don't guess, check on the manufacturer's homepage. Operating systems don't always download the latest drivers.
Title: Re: Texture rendering extremely slow on a specific computer
Post by: adrian17 on August 23, 2013, 04:04:59 pm
Actually, there isn't a "vista" option on their drivers page. On the XP driver (which is 6.11 btw) there is a "Windows Vista Information" link, which doesn't work anymore. I really don't think that AMD would release any new drivers for a 10-year-old card. Therefore, I don't have the choice but to trust Vista's autodownload utility - it had to know that the driver was compatible somehow.