Error in getting the frame rate

Hi.

I’m not rendering anything except for displaying FPS value of the screen. So I should be getting a very high frame rate( NVIDIA 6600GT ).

Inspite of just rendering the FPS value, frame rate is not even crossing 85( both in window mode and full-screen mode).

I’m calculating the frame rate like this:

// Process Application Loop

// get time elapsed since last call
elapsedSeconds = timer->GetElapsedSeconds();

//do motion updates
Update (elapsedSeconds);// Update The Counter

window.Draw (); // Draw Our Scene

//calculate frame rate for a total of 30 frames
window.frameNumber++;
window.totalTimeElapsed += elapsedSeconds;
if(window.frameNumber >= 30)
{
window.frameNumber = 0;
window.fps = 30.0f/window.totalTimeElapsed;
window.totalTimeElapsed = 0.0f;
}

SwapBuffers (window.hDC); // Swap Buffers (Double Buffering)

Where am I going wrong ??

Thanks in advance !

You likely have the vertical synchronization enabled so the buffers can not be swapped faster than the refresh rate of your monitor (85Hz). You can disable the synchronization from driver control panel or using the WGL_EXT_swap_control extension (if application control is allowed in the control panel)

You should also compute the FPS after the swap buffers call. That represents the “actual” rate perceived by the user.

Originally posted by jtipton:
You should also compute the FPS after the swap buffers call. That represents the “actual” rate perceived by the user.
Trough the law of averages it really doesn’t matter where you put it as long as it is in the same place for every frame (though if you place it just before the swap buffers call the FPS can get a bit unstable if you use a lower sample count/time).

I normally do it in the beginning of the loop when i get the delta value, and i also sometimes use an average filter on the displayed FPS just to stabilize it a bit.