press '0' for glDrawBuffer(GL_NONE)
authorBrian Paul <brian.paul@tungstengraphics.com>
Thu, 30 Mar 2006 14:24:58 +0000 (14:24 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Thu, 30 Mar 2006 14:24:58 +0000 (14:24 +0000)
progs/demos/reflect.c

index ce0239211fff68dffdf536a57d4770f440d19a91..0bec0663bc2835d9162110e0c569f4d7253dad54 100644 (file)
@@ -302,11 +302,21 @@ DrawWindow(void)
    GLfloat dist = 20.0;
    GLfloat eyex, eyey, eyez;
 
-   glDrawBuffer(w->drawBuffer);
-   glReadBuffer(w->drawBuffer);
+   if (w->drawBuffer == GL_NONE) {
+      glDrawBuffer(GL_BACK);
+      glReadBuffer(GL_BACK);
+   }
+   else {
+      glDrawBuffer(w->drawBuffer);
+      glReadBuffer(w->drawBuffer);
+   }
 
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
 
+   if (w->drawBuffer == GL_NONE) {
+      glDrawBuffer(GL_NONE);
+   }
+
    eyex = dist  *  cos(w->yrot * DEG2RAD)  *  cos(w->xrot * DEG2RAD);
    eyez = dist  *  sin(w->yrot * DEG2RAD)  *  cos(w->xrot * DEG2RAD);
    eyey = dist  *  sin(w->xrot * DEG2RAD);
@@ -376,10 +386,10 @@ DrawWindow(void)
       ShowAlphaBuffer(w->width, w->height);
    }
 
-   if (w->drawBuffer == GL_BACK)
-      glutSwapBuffers();
-   else
+   if (w->drawBuffer == GL_FRONT)
       glFinish();
+   else
+      glutSwapBuffers();
 
    /* calc/show frame rate */
    {
@@ -460,6 +470,10 @@ Key(unsigned char key, int x, int y)
          w->drawBuffer = GL_FRONT;
       glutPostRedisplay();
       break;
+   case '0':
+      w->drawBuffer = GL_NONE;
+      glutPostRedisplay();
+      break;
    case ' ':
       w->anim = !w->anim;
       w->t0 = -1;