Lab2-GeometryPositionColor (using depth buffer & single buffer)
lab2-moglclassGeometryPositionColor
Geometry – Triangle, Quad, Circle, Sphere, Cube, Cylinder, Torus, Parallelpiped
int main( int argc, char **argv )
{
glutInit(&argc, argv);
glutInitDisplayMode( GLUT_SINGLE | GLUT_RGBA | GLUT_DEPTH );
…
}
void init( void )
{
…
glEnable(GL_DEPTH_TEST);
glClearColor( 1.0, 1.0, 1.0, 1.0 ); // white background
}
void display( void )
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // clear the window
…
glFlush();
}