summaryrefslogtreecommitdiffstats
path: root/progs/demos/engine.c
diff options
context:
space:
mode:
Diffstat (limited to 'progs/demos/engine.c')
-rw-r--r--progs/demos/engine.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/progs/demos/engine.c b/progs/demos/engine.c
index 14fd1e68629..3cf311e7782 100644
--- a/progs/demos/engine.c
+++ b/progs/demos/engine.c
@@ -386,7 +386,10 @@ DrawPositionedPiston(const Engine *eng, float crankAngle)
glPushMatrix();
glRotatef(-90, 1, 0, 0);
glTranslatef(0, 0, pos);
- DrawPiston(eng);
+ if (eng->PistonList)
+ glCallList(eng->PistonList);
+ else
+ DrawPiston(eng);
glPopMatrix();
}
@@ -961,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();
}