# What's better - drawing every interval that the window updates, or drawing when necessary and updating when drawing?

So what's better?

In case the title is a bit confusing I mean:

1) Drawing every window update interval. For example, for a 60FPS window, every 17 milliseconds. For example:

window.setFramerateLimit(60); //Update every 17 milliseconds for 60FPS
while(window.isOpen()) {
window.display();
}


Or

2) Drawing when you need to (for example, when a sprite moves) and displaying it straight after. For example:

void func(sf::RenderWindow& window) {
window.draw(sf::Sprite()); //Whatever you're drawing
window.display();
}


Or is there a much better way?

• Edited for clarity.
– Jay
Jul 24 '15 at 14:06