diff options
author | Keith Whitwell <[email protected]> | 2004-04-23 14:06:02 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2004-04-23 14:06:02 +0000 |
commit | 180e28e6d49ea0c4cdfbf7b80c4ce26c67574d9a (patch) | |
tree | b4e8698268da5672156c643ee88aa95d391ea5b1 | |
parent | 031e86b59723af208f0602afdcc5b729abc055b7 (diff) |
Add fps output
-rw-r--r-- | progs/demos/arbfplight.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/progs/demos/arbfplight.c b/progs/demos/arbfplight.c index 7a405206faa..50a1b7e9f32 100644 --- a/progs/demos/arbfplight.c +++ b/progs/demos/arbfplight.c @@ -25,6 +25,9 @@ static GLboolean Anim = GL_TRUE; static GLboolean Wire = GL_FALSE; static GLboolean PixelLight = GL_TRUE; +static GLint T0 = 0; +static GLint Frames = 0; + static GLfloat Xrot = 0, Yrot = 0; static PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB_func; @@ -68,6 +71,19 @@ static void Redisplay( void ) glPopMatrix(); glutSwapBuffers(); + + Frames++; + + if (Anim) { + GLint t = glutGet(GLUT_ELAPSED_TIME); + if (t - T0 >= 5000) { + GLfloat seconds = (t - T0) / 1000.0; + GLfloat fps = Frames / seconds; + printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps); + T0 = t; + Frames = 0; + } + } } |