diff options
author | Brian Paul <[email protected]> | 2000-04-10 16:25:15 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2000-04-10 16:25:15 +0000 |
commit | a8ede6b076974084fd1f2b4ed9f5554ed9a06d07 (patch) | |
tree | 43853fd19937835dd10d2efd663d167dda4daa99 /progs/demos/clearspd.c | |
parent | 8cce314c325525498c2fa093a9a69ee4ca9f6832 (diff) |
fixed visual selection and reporting results
Diffstat (limited to 'progs/demos/clearspd.c')
-rw-r--r-- | progs/demos/clearspd.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/progs/demos/clearspd.c b/progs/demos/clearspd.c index b2edf320692..e135bf1b953 100644 --- a/progs/demos/clearspd.c +++ b/progs/demos/clearspd.c @@ -1,4 +1,4 @@ -/* $Id: clearspd.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */ +/* $Id: clearspd.c,v 1.2 2000/04/10 16:25:15 brianp Exp $ */ /* * Simple GLUT program to measure glClear() and glutSwapBuffers() speed. @@ -7,8 +7,11 @@ /* * $Log: clearspd.c,v $ - * Revision 1.1 1999/08/19 00:55:40 jtg - * Initial revision + * Revision 1.2 2000/04/10 16:25:15 brianp + * fixed visual selection and reporting results + * + * Revision 1.1.1.1 1999/08/19 00:55:40 jtg + * Imported sources * * Revision 3.3 1999/03/28 18:18:33 brianp * minor clean-up @@ -74,6 +77,7 @@ static void Display( void ) t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; for (i=0;i<Loops;i++) { glClear( BufferMask ); + glFlush(); } t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001; glutSwapBuffers(); @@ -88,12 +92,12 @@ static void Display( void ) clearRate = Loops / (t1-t0); pixelRate = clearRate * Width * Height; if (SwapFlag) { - printf("Rate: %d clears+swaps in %gs = %g clears+swaps/s %d pixels/s\n", - Loops, t1-t0, clearRate, (int)pixelRate ); + printf("Rate: %d clears+swaps in %gs = %g clears+swaps/s %g pixels/s\n", + Loops, t1-t0, clearRate, pixelRate ); } else { - printf("Rate: %d clears in %gs = %g clears/s %d pixels/s\n", - Loops, t1-t0, clearRate, (int)pixelRate); + printf("Rate: %d clears in %gs = %g clears/s %g pixels/s\n", + Loops, t1-t0, clearRate, pixelRate); } } @@ -194,6 +198,8 @@ static void Help( const char *program ) int main( int argc, char *argv[] ) { + GLint mode; + printf("For options: %s -help\n", argv[0]); Init( argc, argv ); @@ -202,7 +208,15 @@ int main( int argc, char *argv[] ) glutInitWindowSize( (int) Width, (int) Height ); glutInitWindowPosition( 0, 0 ); - glutInitDisplayMode( ColorMode | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL | GLUT_ACCUM ); + mode = ColorMode | GLUT_DOUBLE; + if (BufferMask & GL_STENCIL_BUFFER_BIT) + mode |= GLUT_STENCIL; + if (BufferMask & GL_ACCUM_BUFFER_BIT) + mode |= GLUT_ACCUM; + if (BufferMask & GL_DEPTH_BUFFER_BIT) + mode |= GLUT_DEPTH; + + glutInitDisplayMode(mode); glutCreateWindow( argv[0] ); |