Module: Mesa
Branch: master
Commit: 19403935aa4782227a1199cb0355f4bc6c0d02db
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=19403935aa4782227a1199cb0355f4bc6c0d02db

Author: Keith Whitwell <[email protected]>
Date:   Sat Sep 26 08:39:57 2009 +0100

progs/demos: add fps to multiarb

---

 progs/demos/multiarb.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/progs/demos/multiarb.c b/progs/demos/multiarb.c
index 85c4e3a..3d89d3a 100644
--- a/progs/demos/multiarb.c
+++ b/progs/demos/multiarb.c
@@ -27,6 +27,8 @@
 #define ANIMATE 10
 #define QUIT 100
 
+static GLint T0 = 0;
+static GLint Frames = 0;
 static GLboolean Animate = GL_TRUE;
 static GLint NumUnits = 1;
 static GLboolean TexEnabled[8];
@@ -105,6 +107,20 @@ static void Display( void )
    glPopMatrix();
 
    glutSwapBuffers();
+
+   Frames++;
+
+   {
+      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);
+        fflush(stdout);
+        T0 = t;
+        Frames = 0;
+      }
+   }
 }
 
 

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to