From afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1c Mon Sep 17 00:00:00 2001 From: jtg Date: Thu, 19 Aug 1999 00:55:39 +0000 Subject: Initial revision --- progs/demos/clearspd.c | 221 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 progs/demos/clearspd.c (limited to 'progs/demos/clearspd.c') diff --git a/progs/demos/clearspd.c b/progs/demos/clearspd.c new file mode 100644 index 0000000000..b2edf32069 --- /dev/null +++ b/progs/demos/clearspd.c @@ -0,0 +1,221 @@ +/* $Id: clearspd.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */ + +/* + * Simple GLUT program to measure glClear() and glutSwapBuffers() speed. + * Brian Paul February 15, 1997 This file in public domain. + */ + +/* + * $Log: clearspd.c,v $ + * Revision 1.1 1999/08/19 00:55:40 jtg + * Initial revision + * + * Revision 3.3 1999/03/28 18:18:33 brianp + * minor clean-up + * + * Revision 3.2 1999/03/18 08:16:34 joukj + * + * cmpstr needs string.h to included to avoid warnings + * + * Revision 3.1 1998/06/29 02:38:30 brianp + * removed unneeded includes + * + * Revision 3.0 1998/02/14 18:42:29 brianp + * initial rev + * + */ + + +#include +#include +#include +#include +#include + + +static float MinPeriod = 2.0; /* 2 seconds */ +static int ColorMode = GLUT_RGB; +static int Width = 400.0; +static int Height = 400.0; +static int Loops = 100; +static float ClearColor = 0.0; +static GLbitfield BufferMask = GL_COLOR_BUFFER_BIT; +static GLboolean SwapFlag = GL_FALSE; + + + +static void Idle( void ) +{ + glutPostRedisplay(); +} + + +static void Display( void ) +{ + double t0, t1; + double clearRate; + double pixelRate; + int i; + + glClearColor( ClearColor, ClearColor, ClearColor, 0.0 ); + ClearColor += 0.1; + if (ClearColor>1.0) + ClearColor = 0.0; + + if (SwapFlag) { + t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + for (i=0;i