summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2009-03-06 11:05:09 +0000
committerKeith Whitwell <keithw@vmware.com>2009-03-06 21:00:18 +0000
commitb258320dbd0dae943bb817aded392796501a6cde (patch)
tree59d408142ced35eafc0f259050a347da84323320 /progs
parent005ad1a71d8de318a69ba18d896677d89602e0db (diff)
engine: also print fps data to stdout
Useful for figuring out how much of a perf impact the glBitmap fps display has on a given driver.
Diffstat (limited to 'progs')
-rw-r--r--progs/demos/engine.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/progs/demos/engine.c b/progs/demos/engine.c
index af437e2f14..3cf311e778 100644
--- a/progs/demos/engine.c
+++ b/progs/demos/engine.c
@@ -964,6 +964,28 @@ Draw(void)
glEnable(GL_TEXTURE_2D);
}
+ /* also print out a periodic fps to stdout. useful for trying to
+ * figure out the performance impact of rendering the string above
+ * with glBitmap.
+ */
+ {
+ static GLint T0 = 0;
+ static GLint Frames = 0;
+ GLint t = glutGet(GLUT_ELAPSED_TIME);
+
+ Frames++;
+
+ 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;
+ }
+ }
+
+
glutSwapBuffers();
}