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

Author Topic: High CPU usage if window.clear() and window.display() are not in the main loop  (Read 1211 times)

0 Members and 1 Guest are viewing this topic.

sggocu88

  • Newbie
  • *
  • Posts: 13
    • View Profile
Hi. If i don't put window.clear() and window.display() inside the main loop my game have 40-50 cpu usage. If i put them, my game have 1-2 cpu usage.
Why ? Or it's a problem with my pc ?
Sry for bad english

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
window.display() will sleep (pause) if vertical sync is enabled by your graphics driver (or your code). If your main loop makes no pause, your app will consume as much CPU as it can, which means 50% on a dual core CPU.

PS: that's just a guess since you give almost no information
Laurent Gomila - SFML developer

 

anything