diff options
author | José Fonseca <jfonseca@vmware.com> | 2009-03-04 21:46:12 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2009-03-04 21:46:12 +0000 |
commit | f0c92d96568780d5a6c6b53845e9689893ce99e4 (patch) | |
tree | fa6ded0df63936ccd3c9778953407e96f007f607 /progs/trivial/clear-repeat.c | |
parent | 8ad65a23d14f82461c00b1d8dcc1393167f36ab0 (diff) | |
parent | 79a05a6b3f8a995c80d27a1f32f85ad84b1a6f9d (diff) |
Merge commit 'origin/master' into gallium-map-range
Diffstat (limited to 'progs/trivial/clear-repeat.c')
-rw-r--r-- | progs/trivial/clear-repeat.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/progs/trivial/clear-repeat.c b/progs/trivial/clear-repeat.c index 2b3873ef57..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,7 +109,7 @@ 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; |