Advertisement

f rames/skd (fps)

Started by April 14, 2005 05:22 AM
6 comments, last by bearS 19 years, 10 months ago
hello Does gl offer a special method to show the f rame pr second eg fps? I tried to look for it but not knowing a 'name' -and search on this board is disabled :( -why? tia.
regards a.
Nope, there's no magic FPS command that I know of, although some helper libraries (SDL, etc.) might have them.

Simplest way to do it is to have a frame counter that's incremented every frame and reset to zero every second. Each time it's reset, you print its value to your standard output (printf() for linux, OutputDebugString() on windows).

The search function is disabled because the staff are busily writing a new one (I hope [wink]) and Google's site search performs better than the old one.
Advertisement
No, GL is just for graphics so you have to write your own FPS calculator. There was a recent topic on this, clicky.
--
Cheers,
Darren Clark
thank you for replying
refering to the linked topic:
getTime/gettime gives me errors -simply the header is not included
-what header/include is needed?

regards a.
Quote:
Original post by bearS
thank you for replying
refering to the linked topic:
getTime/gettime gives me errors -simply the header is not included
-what header/include is needed?


For timeGetTime():
Include: mmsystem.h
Link: libwinmm.a (or .lib)

You can also make it more precise with a call to timeBeginPeriod(1); in the beginning of your game and timeEndPeriod(1); in the end;
Killers don't end up in jailThey end up on a high-score!
in the end i used getTickCount() (windows.h)
There is also a multimedia timer class whitch i will look into- this class is prefered for time critical programming -eg midi file usage amo , but realy precise timing in a game should posibly also be based on this class

ty.
regards a.
Advertisement
Did you manage to get timeGetTime() working, or are you using getTickCount() because timeGetTime() didn't work?
--
Cheers,
Darren Clark
getTickCount() should be better for windows app.
After reading up on both at msdn i choose to go for getTickCount()
The multimedia timer class is undoubtly the optimal solution, but comes with an overhead becuase it is precise (therefore complex too..) to the very milisecond. Thats over doing it..


regards a.

This topic is closed to new replies.

Advertisement