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

Author Topic: Laggy rendering.  (Read 20142 times)

0 Members and 1 Guest are viewing this topic.

Veritas

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
    • Email
Re: Laggy rendering.
« Reply #45 on: May 08, 2014, 11:14:15 am »
I updated my nvidia drivers and everything works. I have one issue with vertical sync though, it seems to cap rendering to 40 fps. As a result of this I get some stuttering. Does anyone have any idea how to fix this?
"Lasciate ogni speranza, voi ch'entrate"

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11008
    • View Profile
    • development blog
    • Email
Re: Laggy rendering.
« Reply #46 on: May 08, 2014, 11:22:04 am »
I have one issue with vertical sync though, it seems to cap rendering to 40 fps. As a result of this I get some stuttering. Does anyone have any idea how to fix this?
What's the refresh rate of your screen?
Do you run it in window mode?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Veritas

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
    • Email
Re: Laggy rendering.
« Reply #47 on: May 08, 2014, 12:21:31 pm »
Screen's refresh rate is 60 hz.
Yes I run it window mode.

In case I am not measuring the frames correctly here is the testing loop:

        sf::RenderWindow window(sf::VideoMode(1024, 768), "Testing");
                window.setVerticalSyncEnabled(true);
        sf::Clock clock;
        sf::Event event;
        float elapsed;
        while(window.isOpen())
        {
                elapsed += clock.restart().asSeconds();
                std::cout << 1.f/elapsed << std::endl;
                while(elapsed > 1.f/60.f)
                {
                        while(window.pollEvent(event))
                        {
                                if (event.type == sf::Event::Closed || event.key.code == sf::Keyboard::Escape)
                                {
                                        window.close();
                                }
                        }
                        elapsed -= 1.f/60.f;
                }
                window.clear();
                window.display();
        }

What happens is that it starts at 50 fps, goes up to 60 something and then falls down to 30 and starts incrementing again.
« Last Edit: May 08, 2014, 12:47:20 pm by Veritas »
"Lasciate ogni speranza, voi ch'entrate"

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11008
    • View Profile
    • development blog
    • Email
Re: Laggy rendering.
« Reply #48 on: May 08, 2014, 12:36:38 pm »
You can just do
std::cout << 1.f/clock.resetart().asSeconds() << std::endl;

But it's probably more a driver thing, some drivers change the refresh rate in window mode. Not sure, but there might be an option in your driver settings.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Veritas

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
    • Email
Re: Laggy rendering.
« Reply #49 on: May 08, 2014, 09:32:49 pm »
It seems that the same happens in fullscreen mode too.
I reinstall the driver but the problem persists. I am also concerned about the 40-500 fps rate range when not using vsync.
"Lasciate ogni speranza, voi ch'entrate"

Veritas

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
    • Email
Re: Laggy rendering.
« Reply #50 on: May 09, 2014, 04:01:03 pm »
Fixed. I needed to use an extra variable to correctly keep track of the frames. Simply using the elapsed variable didn't cut it. I will now test some more and notify you about the performance.
"Lasciate ogni speranza, voi ch'entrate"

 

anything