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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Dalini

Pages: [1]
1
General / Re: How slow is window.draw() ?
« on: December 19, 2013, 08:19:18 pm »
Just program your game and wait with optimizing until it is really needed.

I totally agree and that's what I was doing. It worked fine on a small map, and then came the big one, and I had 20 FPS for only 500-600 sprites displayed. I tried to profile it, it appeared that the window.draw() where taking away most of the FPS.

I checked my code, and I'm not doing something stupid like creating the sprites every update.

I'm out of ideas, and it seemed to me that something as simple as that shouldn't be so slow.
This is why I asked on this forum.

2
General / Re: AW: How slow is window.draw() ?
« on: December 19, 2013, 06:04:33 pm »
FPS is non-linear, thus it's hard to make a judgment based on some drop in FPS, but SFML should be able to handle a few thousand sprites/shapes on a more or less modern GPU.

That was exactly my thought.
I'm talking about something like 600 sprites. But the FPS drops doesn't seem to be related to the number of sprites, but to their size.

I just tried something else:

sf::RectangleShape background_;
background_.setSize(sf::Vector2f(1900, 1000));
background_.setFillColor(sf::Color(235, 235, 235));
background_.setOutlineColor(sf::Color::Black);
background_.setOutlineThickness(1);
background_.setPosition(20, 20);

sf::RenderWindow window(sf::VideoMode(1920, 1080, 32), "Title");

while (window.isOpen()) {
    sf::Event event;
    while (window.pollEvent(event)) {
        // Close window : exit
        if (event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) {
            window.close();
        }
    }

    window.clear(sf::Color(150, 150, 150));

    window.draw(background_);
    window.draw(background_);
    window.draw(background_);
    window.draw(background_);
    window.draw(background_);
    window.draw(background_);
    window.draw(background_);
    window.draw(background_);
    window.draw(background_);
    window.draw(background_);

    window.display();
}
 

That's only 10 sprites, shouldn't be a problem right? and yet the FPS is down to 55 with that code (the FPS is given by FRAPS by the way).

The GPU is Intel(R) HD Graphics 4000.


3
General / How slow is window.draw() ?
« on: December 19, 2013, 05:35:28 pm »
Hi there,

I'm running a very basic SFML app, with two cases. One where I display a sprite, one where I do not.
Here is the FPS between thoses cases:

  • Without displaying a sprite: 350 FPS
  • When displaying a sprite: 230 FPS

Here are the code sample:

sf::RectangleShape background_;
background_.setSize(sf::Vector2f(1900, 1000));
background_.setFillColor(sf::Color(235, 235, 235));
background_.setOutlineColor(sf::Color::Black);
background_.setOutlineThickness(1);
background_.setPosition(20, 20);

sf::RenderWindow window(sf::VideoMode(1920, 1080, 32), "Title");

while (window.isOpen()) {
        sf::Event event;
        while (window.pollEvent(event)) {
                // Close window : exit
                if (event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) {
                        window.close();
                }
        }

        window.clear(sf::Color(150, 150, 150));

    // Upon uncommenting this line, I lose about 120 FPS
        //window.draw(background_);

        window.display();
}
 

Of course getting from 350 FPS to 230 is acceptable, it still is a high value, but the problem is that when I try to display several hundred of sprites (just sf::Shape, nothing fancy), I get below 25 FPS.

Any idea about what I am doing wrong ?

4
Quote
Also you'll probably have a lot more warnings to correct if you plan to update SFML for C++11 one day
Why?

I just meant that some C++11 warnings options such as -Wzero-as-null-pointer-constant will generate a lot of warnings until you correct them all.

Quote
As far as I can remember, I only got a couple of warnings about methods arguments that were not used (I was compiling with clang++).
I can't remember the source file, but if you're interested let me know and I'll find out.
Yes, I'm interested. I compile with CLang and the above flags, and get no warning (except in stb_image, and one caused by a bug in CLang).

I remember for instance the file SFML/System/Utf.inl. Some methods arguments were not used (as in In Utf<32>::next(In begin, In end)), but I can see that it has been fixed now, so nevermind that, sorry :P

5
Also you'll probably have a lot more warnings to correct if you plan to update SFML for C++11 one day.

As far as I can remember, I only got a couple of warnings about methods arguments that were not used (I was compiling with clang++).
I can't remember the source file, but if you're interested let me know and I'll find out.

6
General discussions / Do you use C++11?
« on: March 12, 2012, 11:20:08 pm »
Too bad we'll have to wait at least a year before we can see the major compilers (GCC, Clang, MSVC) support all the features of the C++11 :-(

7
SFML projects / My SFML game - Terrena (alpha 10)
« on: October 10, 2011, 11:02:44 pm »
According to the image the game looks very nice.

However your link for download doesn't work with the "[/img]" in it ;)

Pages: [1]