|
From: St0fF 6. <st...@gm...> - 2001-09-26 08:34:51
|
Hi Stein!
Easy way to do this would be using GLUT.
#include <GL/glut.h>
and then use the glut timer function to determine when a second is over. =
=20
int main(blabla) {
blablabla
glutTimerFunc(1000,time,1);
blablabla
glutMainLoop();
return 0;
}
Well. So far where we get the complete seconds from ...
Now the display callback function has to increment the framecounter =
every time its called. And our fps-calculator looks like this:
static int frames,oldframes,fps;
void time(int egal) {
glutTimerFunc(1000,time,1);
fps =3D frames - oldframes;
oldframes =3D frames;
}
By now you have a variable that gets updated every second displaying how =
many fps your're displaying at.
If you wanted to do something really bound to time, like e.g. want to =
determine, if you'll have to leave out some frames or use them twice =
(for constant framerate), you should use something else than glut. I =
haven't tried, yet. If you figured out a better method it would be =
greatly aprecciated if you shared it with us.
CU, St0fF.
----- Original Message -----=20
From: "Stein Nyg=E5rd" <ste...@ge...>
To: <dev...@li...>
Sent: Tuesday, September 25, 2001 11:00 PM
Subject: [Dev-C++] FPS counter?
| Hi all...
|=20
| I's been a while, cause I've been busy setting up my new Athlon =
1400mhz.
| It's working great, so now I'm ready to move on with the OpenGL!
| So, I just can't figure out how to make a good, fast and precise
| FramesPerSecond-Counter. Any suggestions?
| Thanks!
|=20
| Stein
|=20
|=20
| _______________________________________________
| Dev-cpp-users mailing list
| Dev...@li...
| https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|