Hi Ixrec,
First of all, thanks for dedicating your precious time writing a so complete answer.
I'm measuring FPS this way:
sf::ContextSettings settings;
settings.antialiasingLevel = 16;
sf::RenderWindow window(sf::VideoMode(1280, 720), "Test SFML", sf::Style::Default, settings);
window.setKeyRepeatEnabled(false);
window.setMouseCursorVisible(false);
window.setVerticalSyncEnabled(true);
// window.setFramerateLimit(59);
Game game;
sf::Clock clock;
float dt;
game.init();
while (window.isOpen()) {
dt = clock.restart().asSeconds();
window.clear();
game.update(dt);
game.render(window);
window.display();
}
About setting Framerate limit to 59, it works perfectly. FPS keeps nearly constant (small variation). The problem with the V-Sync is that the deltaTime just goes from 0.0016 to 0.00001 (random values), and when it comes back to 0.0016 the animation is affected, once it depends on deltaTime.
Am I measuring time correctly?
I'm on iMac. Its hardware is very good. The GPU is AMD Radeon HD 6750M 512 MB. That's why I'm surprised to see the framerate spikes happening on rendering frames with just a green sf::Circle and a sf::Sprite moving.