Hey,
this is just to confirm my thoughts.
First, I assume that each time the update() method is called it means a frame is built right ? So if I count the number of update I’ll have the number of frames right ?
Then, the variable tpf is the time spent in the building of the precedent frame right ? So if I print 1/tpf I’ll have the current mean FPS rate right ?
Finally, is there a better way (more accurate) to know the FPS rate in real time than printing the 1/tpf value ?
Yes thats right. And no, how could it be more precise? Tpf is derived from the built-in timer. You can e.g. Accumulate the tpf’s to measure passed time.
What I usually do is keep adding the tpf onto some timer until it hits 1 (e.g. one second) then I could know many frames past since then. This gives you the exact value of how many frames per second occurred in the last second
Yeah I was thinking about something like this but 1 second is too long so I’ll likely do it for half/quarter a second… but that’s the same thing.