galaktor
18-11-2008 21:58:13
Hi
i am working on a little game engine and am implementing a timing functionality which controls the game loop and calculates statistics such as frames per second, updates per second. I have been getting some weird values in the last few days and have finally decided to ask you guys if you know someting that I do not (which is pretty likely ).
I thought my FPS calculation was buggy since the values were always way off the FPS Values Ogre seems to calculate.
Avg FPS: 302,00005000125 <== My calculated value
Ogre Last Fps: 24,2483
After trying to find possible mistakes in my code and rewriting everything from scrath on and on, it always ended in the same phenomenon. So then I added Thread.Sleep( 500 ) to my main loop, assuming that I should get a framerate at around 2 FPS. And this is what I got:
Avg FPS: 1,99718174316474
Ogre Last Fps: 1,992032
So this shows me two things: 1. My calculation can't be too far off. And 2. Ogre's neither. So what the heck is going on in the first case? Assuming that my calculations are not wrong, I can only conclude that Ogre may have some framerate limitation activated or so, since my loop seems to be running at around 300 FPS and calling the RenderOneFrame() every time.
Anybody know if there could be such a limitation? How could I deactivate it?
Thx
EDIT:
I continued forcing the loop into framerates with Sleep. I got the following results:
Sleep( 50 ) ~20 FPS:
Avg FPS: 18,2121325949276
Ogre Last Fps: 18,28681
Sleep( 40 ) ~ 25 FPS:
Avg FPS: 22,253193960511
Ogre Last Fps: 21,97802
From here on (somewhere around 22 - 25 FPS), Ogre never gets any higher.
Sleep( 30 ) ~ 33 FPS:
Avg FPS: 28,3399739795089
Ogre Last Fps: 23,50637
Also note that since I am doing a lot of logging and other stuff except for "sleeping" so the ideal framerate cannot be achieved. Besides that, my FPS displayed here is smoothed (averaged) over 5 frames.
i am working on a little game engine and am implementing a timing functionality which controls the game loop and calculates statistics such as frames per second, updates per second. I have been getting some weird values in the last few days and have finally decided to ask you guys if you know someting that I do not (which is pretty likely ).
I thought my FPS calculation was buggy since the values were always way off the FPS Values Ogre seems to calculate.
Avg FPS: 302,00005000125 <== My calculated value
Ogre Last Fps: 24,2483
After trying to find possible mistakes in my code and rewriting everything from scrath on and on, it always ended in the same phenomenon. So then I added Thread.Sleep( 500 ) to my main loop, assuming that I should get a framerate at around 2 FPS. And this is what I got:
Avg FPS: 1,99718174316474
Ogre Last Fps: 1,992032
So this shows me two things: 1. My calculation can't be too far off. And 2. Ogre's neither. So what the heck is going on in the first case? Assuming that my calculations are not wrong, I can only conclude that Ogre may have some framerate limitation activated or so, since my loop seems to be running at around 300 FPS and calling the RenderOneFrame() every time.
Anybody know if there could be such a limitation? How could I deactivate it?
Thx
EDIT:
I continued forcing the loop into framerates with Sleep. I got the following results:
Sleep( 50 ) ~20 FPS:
Avg FPS: 18,2121325949276
Ogre Last Fps: 18,28681
Sleep( 40 ) ~ 25 FPS:
Avg FPS: 22,253193960511
Ogre Last Fps: 21,97802
From here on (somewhere around 22 - 25 FPS), Ogre never gets any higher.
Sleep( 30 ) ~ 33 FPS:
Avg FPS: 28,3399739795089
Ogre Last Fps: 23,50637
Also note that since I am doing a lot of logging and other stuff except for "sleeping" so the ideal framerate cannot be achieved. Besides that, my FPS displayed here is smoothed (averaged) over 5 frames.