Skip to main content
GameDev.net gamedev.net
🔒 Locked

finding fps with nehe basecode

Started by jocko_jonson Jan 8, 2004 at 9:23 PM 2 replies 350+ views
Original Post
jocko_jonson
jocko_jonson
Heya. I'm using the nehe basecode latest. One thing I've noticed is that the frame rate on my openGL app is always half the monitor refresh rate. So even with a blank screen the openGL app runs at 30 fps if the monitor refresh is 60hz. I've run it on both 1.8GHZ and 3.0GHZ systems and the frame rate is the same. I'm calculating frame rate as follows: float FPScounter = 0; double FPStimer = 0.0; float FPS = 0; void Update (DWORD milliseconds) { FPStimer += milliseconds; if(FPStimer>1000.0) { FPS = (float)FPScounter; FPScounter = 0; FPStimer = 0.0; } else { FPScounter++; FPStimer+=milliseconds; } } void display(void) { glRasterPos2f(-5.0f, 3.5f); glPrint("FPS:%7.0f", FPS); } Basically, every frame I just add 1 to the counter. When 1 second has elapsed I output that number and reset the counter. Is something wrong with this? Ooops sorry for the double post below. =( [edited by - jocko_jonson on January 8, 2004 10:26:16 PM]
orbano
orbano
in the code if FPSTimer does not reach 1 sec, you increase it two times. once in the beginning of the function and once in the else branch. i think this is why you get the half result
"Knowledge is no more expensive than ignorance, and at least as satisfying." -Barrin
jocko_jonson
jocko_jonson
duh. oops hehe. thanks!

Anyone know a way to un-sync the app frame rate from the monitor refresh rate?
Intamin AG
Intamin AG
Try disabling V-Sync in your card settings??
The world isn't unpredictable. It's CHAOTIC.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.