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);
ShowAlphaBuffer(w->width, w->height);
}
- if (w->drawBuffer == GL_BACK)
- glutSwapBuffers();
- else
+ if (w->drawBuffer == GL_FRONT)
glFinish();
+ else
+ glutSwapBuffers();
/* calc/show frame rate */
{
GLfloat seconds = (t - t0) / 1000.0;
GLfloat fps = frames / seconds;
printf("%d frames in %g seconds = %g FPS\n", frames, seconds, fps);
+ fflush(stdout);
t0 = t;
frames = 0;
}
w->drawBuffer = GL_FRONT;
glutPostRedisplay();
break;
+ case '0':
+ w->drawBuffer = GL_NONE;
+ glutPostRedisplay();
+ break;
case ' ':
w->anim = !w->anim;
w->t0 = -1;