SFML community forums
Help => General => Topic started by: efeXor on January 16, 2009, 04:02:26 am
-
After doing the render window tutorial i get like 48% cpu usage. Why and how can i fix?
-
48% while the app is running or after?
Because if its while the app is running its totally normal.....
-
It trying to render as fast as it can. You could limit the frame rate by adding waits to each loop.
-
48% while the app is running or after?
Because if its while the app is running its totally normal.....
how is that in any way normal?
-
48% while the app is running or after?
Because if its while the app is running its totally normal.....
how is that in any way normal?
Take a look at any game. What is your cpu usage at while its running?
-
To solve the problems, you can try to:
1. set a framerate limit (sf::RenderWindow::SetFramerateLimit)
2. enable vertical synchronization (sf::RenderWindow::UseVerticalSync)
3. write your own framelimiting code (sf::Sleep)
I hope that helps.
-
how is that in any way normal?
The program consists of an endless loop that never pauses. It simply eats all the CPU it can.
-
Have you got a dual core processor? Single core processors can even be working to capacity with infinite loops.
Follow one of Avency's steps. I use sf::Sleep and in release mode, the CPU usage is less than 5% (about 33 FPS and dual core).