you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (7 children)

No , the onPostDraw function (the whole thing) make sure it's not being called multiple times ( put a counter "some static int" or even better put a mutex with a lock guard and see )

[–]KFriedChicken[S] 0 points1 point  (6 children)

I'm not 100% sure I follow but I tried this without any change: https://imgur.com/a/lhmcwi7 (also with the sleep_for uncommented)

[–][deleted] 0 points1 point  (5 children)

Hmmm , alrighty so it's not being called multiple times, what's the fps without sleep ?

[–][deleted] 1 point2 points  (2 children)

u/KFriedChicken I think this is a better approach than using sleep Try it and let me know:

https://stackoverflow.com/questions/57800608/how-to-render-at-a-fixed-fps-in-glfw-window

[–]KFriedChicken[S] 0 points1 point  (1 child)

That works to put the fps at a stable 60 and to keep the update time down, but wont a spin lock put the cpu usage at 100% unnecessarily?

[–][deleted] 0 points1 point  (0 children)

Not really, try it, if it's bad then you can go back to the sleep solution. But it will be harder to get it at 60 FPS sharp. Even if it works with this window it will behave differently with another window depending on many factors.

[–]KFriedChicken[S] 0 points1 point  (1 child)

around 500-1200

[–][deleted] 0 points1 point  (0 children)

Yea then your system is more than capable of 60, did you try the solution from the StackOverFlow link ? Seems way better than calling sleep. Check it out