fixed visual selection and reporting results
This commit is contained in:
@@ -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.
|
* Simple GLUT program to measure glClear() and glutSwapBuffers() speed.
|
||||||
@@ -7,8 +7,11 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: clearspd.c,v $
|
* $Log: clearspd.c,v $
|
||||||
* Revision 1.1 1999/08/19 00:55:40 jtg
|
* Revision 1.2 2000/04/10 16:25:15 brianp
|
||||||
* Initial revision
|
* 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
|
* Revision 3.3 1999/03/28 18:18:33 brianp
|
||||||
* minor clean-up
|
* minor clean-up
|
||||||
@@ -74,6 +77,7 @@ static void Display( void )
|
|||||||
t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
|
t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
|
||||||
for (i=0;i<Loops;i++) {
|
for (i=0;i<Loops;i++) {
|
||||||
glClear( BufferMask );
|
glClear( BufferMask );
|
||||||
|
glFlush();
|
||||||
}
|
}
|
||||||
t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
|
t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
|
||||||
glutSwapBuffers();
|
glutSwapBuffers();
|
||||||
@@ -88,12 +92,12 @@ static void Display( void )
|
|||||||
clearRate = Loops / (t1-t0);
|
clearRate = Loops / (t1-t0);
|
||||||
pixelRate = clearRate * Width * Height;
|
pixelRate = clearRate * Width * Height;
|
||||||
if (SwapFlag) {
|
if (SwapFlag) {
|
||||||
printf("Rate: %d clears+swaps in %gs = %g clears+swaps/s %d pixels/s\n",
|
printf("Rate: %d clears+swaps in %gs = %g clears+swaps/s %g pixels/s\n",
|
||||||
Loops, t1-t0, clearRate, (int)pixelRate );
|
Loops, t1-t0, clearRate, pixelRate );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("Rate: %d clears in %gs = %g clears/s %d pixels/s\n",
|
printf("Rate: %d clears in %gs = %g clears/s %g pixels/s\n",
|
||||||
Loops, t1-t0, clearRate, (int)pixelRate);
|
Loops, t1-t0, clearRate, pixelRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,6 +198,8 @@ static void Help( const char *program )
|
|||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
|
GLint mode;
|
||||||
|
|
||||||
printf("For options: %s -help\n", argv[0]);
|
printf("For options: %s -help\n", argv[0]);
|
||||||
|
|
||||||
Init( argc, argv );
|
Init( argc, argv );
|
||||||
@@ -202,7 +208,15 @@ int main( int argc, char *argv[] )
|
|||||||
glutInitWindowSize( (int) Width, (int) Height );
|
glutInitWindowSize( (int) Width, (int) Height );
|
||||||
glutInitWindowPosition( 0, 0 );
|
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] );
|
glutCreateWindow( argv[0] );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user