summaryrefslogtreecommitdiff
path: root/progs/trivial/clear-repeat.c
diff options
context:
space:
mode:
Diffstat (limited to 'progs/trivial/clear-repeat.c')
-rw-r--r--progs/trivial/clear-repeat.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/progs/trivial/clear-repeat.c b/progs/trivial/clear-repeat.c
index 9f9490c6c8..9c618d492f 100644
--- a/progs/trivial/clear-repeat.c
+++ b/progs/trivial/clear-repeat.c
@@ -72,6 +72,24 @@ static void Draw(void)
glClearColor((sin(f)+1)/2.0,(cos(f)+1)/2.0,0.5,1);
glClear(GL_COLOR_BUFFER_BIT);
glutSwapBuffers();
+
+ {
+ 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;
+ }
+ }
+
}
glutPostRedisplay();
}
@@ -91,13 +109,13 @@ int main(int argc, char **argv)
exit(1);
}
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
type = GLUT_RGB | GLUT_ALPHA;
type |= GLUT_DOUBLE;
glutInitDisplayMode(type);
- if (glutCreateWindow("First Tri") == GL_FALSE) {
+ if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}