added f key to toggle front/back drawing
authorBrian Paul <brian.paul@tungstengraphics.com>
Thu, 21 Oct 1999 22:13:58 +0000 (22:13 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Thu, 21 Oct 1999 22:13:58 +0000 (22:13 +0000)
progs/demos/drawpix.c

index 264df71ab4e6ad9ff72460c599978dbfc729262f..7c858da697b1fba1b43038f72235e4f4b983d936 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drawpix.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
+/* $Id: drawpix.c,v 1.2 1999/10/21 22:13:58 brianp Exp $ */
 
 /*
  * glDrawPixels demo/test/benchmark
@@ -8,8 +8,11 @@
 
 /*
  * $Log: drawpix.c,v $
- * Revision 1.1  1999/08/19 00:55:40  jtg
- * Initial revision
+ * Revision 1.2  1999/10/21 22:13:58  brianp
+ * added f key to toggle front/back drawing
+ *
+ * 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
@@ -44,6 +47,7 @@ static int SkipPixels, SkipRows;
 static int DrawWidth, DrawHeight;
 static int Scissor = 0;
 static float Xzoom, Yzoom;
+static GLboolean DrawFront = GL_FALSE;
 
 
 
@@ -82,7 +86,8 @@ static void Display( void )
 
    glDisable(GL_SCISSOR_TEST);
 
-   glutSwapBuffers();
+   if (!DrawFront)
+      glutSwapBuffers();
 }
 
 
@@ -100,6 +105,11 @@ static void Benchmark( void )
    if (Scissor)
       glEnable(GL_SCISSOR_TEST);
 
+   if (DrawFront)
+      glDrawBuffer(GL_FRONT);
+   else
+      glDrawBuffer(GL_BACK);
+
    /* Run timing test */
    draws = 0;
    startTime = glutGet(GLUT_ELAPSED_TIME);
@@ -187,6 +197,14 @@ static void Key( unsigned char key, int x, int y )
       case 'b':
          Benchmark();
          break;
+      case 'f':
+         DrawFront = !DrawFront;
+         if (DrawFront)
+            glDrawBuffer(GL_FRONT);
+         else
+            glDrawBuffer(GL_BACK);
+         printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK");
+         break;
       case 27:
          exit(0);
          break;
@@ -270,6 +288,7 @@ static void Usage(void)
    printf("           r  Decrease GL_UNPACK_SKIP_ROWS\n");
    printf("           R  Increase GL_UNPACK_SKIP_ROWS\n");
    printf("           s  Toggle GL_SCISSOR_TEST\n");
+   printf("           f  Toggle front/back buffer drawing\n");
    printf("           b  Benchmark test\n");
    printf("         ESC  Exit\n");
 }