Advertisement

Measuring fps in my window

Started by October 08, 2002 07:27 PM
6 comments, last by StickDeath 22 years, 4 months ago
how would i meause fps in my window so i can display it in the corner?
It''s all fun and games till someone loses an eye, then its a sport
int FrameRate()
{
static int CurFrames=0;
static int FPS=0;
static unsigned int LastTimer=GetTickCount();

CurFrames++;

if(GetTickCount()-LastTimer>50)
{
FPS=CurFrames;
CurFrames=0;
LastTimer=GetTickCount();
}
return FPS*20;
}
Advertisement
thanks for that info

do u know how accurate this is? but if u don''t its all good cause i jus wanna note difference with fullscreen/windowed and the different resolutions
thanks again
It''s all fun and games till someone loses an eye, then its a sport
Make sure you draw a fairly complicated scene if you want to compare FPS just between different resolutions.
From what I''ve known... the GetTickCount() is very accurate. I''m not sure about the number but it is smaller than 1/(a million).
http://www.fraps.com/
its cool:D
made that video with it:
http://www.itstudents.ch/users/dave/tenebrae.divx.zip

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Advertisement
uh.. getTickCount is very low accuracy. (it seems to jump in blocks of 10ms)..

I remember posting some code very similar to AP's... so I won't repost, I'll just say it's probably best to keep the updates to every second, not every 20th if using getTickCount, but if using, say, timeGetTime, then that'd probably be fine...

[edit]

actually. Now I read it again, definitly update every second, not every 1/20th... otherwise your frame rate will always be a multiple of 20, and therefor, insanly inaccurate.

Note:
that method is significantly more accurate at high fps than simply inversing the elapsed time...

<-- smile :-)

[edited by - RipTorn on October 10, 2002 4:54:09 AM]
i have a procdure that was posted before for calculateing my fps, im a newbie to programming so i''ll need a bit more help with how to get it.

if u could type a procedure out that would be good but if u can''t sweet as

It''s all fun and games till someone loses an eye, then its a sport

This topic is closed to new replies.

Advertisement