FPS counter going nuts!

Started by
1 comment, last by Saandman 21 years, 6 months ago
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
________________________________pro.gram.mer - an organism that turns caffeine into code
Advertisement
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
Chris Z. GPU FX
Thanks!

/Sandman
________________________________pro.gram.mer - an organism that turns caffeine into code

This topic is closed to new replies.

Advertisement