View Full Version : Frames per second counter
Allan
03-27-2001, 01:05 AM
Hi,
Ive made a landscape generator and want to be be able to see how many frames per second it's running at. Does anyone know of any good programs that can do this?
thanks
Nutty
03-27-2001, 03:09 AM
Write some font code, and display it yourself.
Very easy to do. Get some high precision timers (in win32 api) and time each frame.
then fps is merely 1.0f / frame time.
then just render it.
sorted.
Nutty
// gets the time
static float gettime(void)
{
float tnew,ris;
static float told=0.0f;
tnew=glutGet(GLUT_ELAPSED_TIME);
ris=tnew-told;
told=tnew;
return ris/1000.0;
}
// you hav a variable FPS, with some value:
#define FRAME 50
// and then you can call in your main render
// function:
if((framecount % FRAME)==0)
{
fr=gettime();
}
framecount++;
// now FRAME/fr is your FPS.
// it gets updates every 50 frames.
Leyder Dylan
03-28-2001, 06:24 AM
Hi,
http://slug-production.ibelgique.com
Download Section
There's a example who display the FPS on the screen.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.