Archived

This topic is now archived and is closed to further replies.

Saandman

FPS counter going nuts!

Recommended Posts

Hi! I have an FPS counter based on the QueryPerformanceXXX() method. The only problem is, when I run my program in full-screen or windowed, the counter goes nuts and displays the numbers all too fast! Even though I have set it to 2.1f it displays like a three-digit number. I have disabled VSync. I render the numbers like this: sprintf(buffer, "%2.1f", D3DGetFPS()); WhateverPrintFunc(buffer, X, Y, ...); I can see I''m in between 3000-5000.. My question in essence; how to I slow it down so that you actually can READ the numbers!? Thanks /Sandman

Share this post


Link to post
Share on other sites
Simply put, don''t try to update your fps every frame. Update it every few seconds - by taking the average number of frames over the elapsed time.

if( timeElapsedSinceLastUpdate > 3 seconds )
fps = totalFramesAccumulated/3.0

You can make the interval whatever you wish though.

Chris Z.
ZeroFX Interactive

Share this post


Link to post
Share on other sites