Simple way to get frames per second..?


I know there is a base.setFrameRateMeter(True) call you can make to show the FPS…

I want a more pretty way of displaying it, and I want to add it to some of my own DirectGui elements, I was wondering if there is a way I can get the FPS number?

i.e. base.getFrameRateNumber() <-- would return 60.0 or something similar?

I’ve looked around and thought that maybe just posting would be the best option…



Try globalClock.getAverageFrameRate().


Hi wow thank you both!

such a speedy reply! :smiley:

Also note, for the record, that you can create a FrameRateMeter object, which is a subclass of TextNode and therefore has all of the formatting properties that TextNode has (including font, color, what-have-you), except that it automatically updates itself with the current frame rate. So all you have to do is parent a FrameRateMeter anywhere you want and you don’t even have to run a task to keep it updated.


Oh! that helps alot, thank you very very much! :smiley:

what a handy feature :stuck_out_tongue: