Frame per second

In my application an object of opengl rotate continuously.How i find the fps(frame per second)for that Object.

Calculate the time it takes to render that frame. fps = 1/time.

Bob,
please give some detail for clearity.

With regards
Rajiv Kumar

hi,

You will find an exe/src about what you search. It is in french …I don’t know if it is the best but for me, it works well.

link for the fps
http://ibelgique.ifrance.com/Slug-Production/Download/Fps.zip

link for all
http://ibelgique.ifrance.com/Slug-Production/Francais/Fichiers/Download.htm

Does anyone know of a non windows specific fps counter code? I’ve found a lot that are windows specific but haven’t found a single one that isn’t. The glut timerfunc does not seem to update itself often enough to be effective.

long start, end, frames;

void init_fps()
{
start = time(NULL);
frames = 0;
}

void get_fps()
{
end = time(NULL);
frames++;
if(start != end)
printf("FPS : %f
", (float)frames/(float)(end-time));
}

You have only to make a call init_fps() in the beginning and call get_fps() at the end of each redisplay.

@+
Cyclone

I have make a error in the get_fps(), the calculation is frames/(end-start) …

void get_fps()
{
end = time(NULL);
frames++;
if(start != end)
printf("FPS : %f
", (float)frames/(float)(end-start));
}

@+
Cyclone

Hello Cyclone,
Many-Many Thanks,
Rajiv Kumar