On Sun, 30 Jul 2000, Pai-Hung Chen wrote:
> (1) Is there a universally agreed way to calculate
> Frame-Per-Second information?
Well, if you have a good timer, you could try to measure
the duration of a single frame - and then do a moving
average of a few dozen frames in order to filter the
results a bit - but the problem is that graphics cards
are typically quite heavily pipelined - so you can't
just measure the time from (say) swap-buffer to swap-buffer.
What I usually do is to use the 'time()' function (which returns
time in seconds) and count the number of frames between
the returned value changing and it changing again. The result
is an integer number of frames that's only accurate to +/- 1Hz,
but that's good enough for most purposes.
Call this every frame for example:
static time_t old_t = 0 ;
static int nframes = 0 ;
static int hz_rate = 0 ;
time_t t = time ( NULL ) ;
if ( t != old_t )
{
hz_rate = nframes / ( t - old_t ) ;
nframes = 1 ;
old_t = t ;
}
else
nframes++ ;
display ( hz_rate ) ;
Of course you should disable the vertical retrace sync before
you do any measurement - or else the rate will always be
an integer sub-multiple of the CRT refresh rate! (eg for a
60Hz CRT, you'd only see 60,30,20,15 etc.)
> (2) What is the acceptable FPS for today's 3D games?
IMHO (and opinions vary), you should achieve the exact
frame rate of the monitor you are driving - which could
be anywhere from 60 to 76Hz for most users. You should
enforce that exact rate by syncing the buffer swap to
the CRT vertical retrace using whatever means your
driver offers.
My reasoning is:
Faster than that is silly because at best your users
won't see many of the frames that you draw and at
worst you'll get a tear in the middle of your image
somewhere because you aren't synced to the vertical
retrace.
Slower will also produce that annoying tear - unless
you are locked to the retrace in which case your
frame rate will automatically drop to half the video
rate. At 30 to 38Hz (half the frame rate), you'll
get REALLY annoying double-imaging whenever something
moves fast on the screen. The reasons for the double-
imaging are interesting - but not relevent to the
discussion.
What is actually "acceptable" to gamers will depend on
the individual. If I was using an older 133MHz PC with
a Voodoo-1 card, I'd count myself lucky to get a barely
playable 10Hz with a modern game. If I'd just spent a
packet on an 1.3GHz overclocked *beast* with a GeForce-2,
I'd be rather upset if I didn't get 60Hz on my 60Hz CRT
or 72Hz on my 72Hz CRT.
I work in flight simulation where people are VERY
picky about the quality of their imagery - and anything
other than the exact frame rate of the CRT would result
in my customer justifiably refusing to certify the simulator.
Steve Baker (817)619-2657 (Vox/Vox-Mail)
L3Com/Link Simulation & Training (817)619-2466 (Fax)
Work: sj...@li... http://www.link.com
Home: sjb...@ai... http://web2.airmail.net/sjbaker1
|