/* * glexample.c * (c) Neil Gershenfeld 2/4/03 * draw a sphere and a cube with GLUT */ #include void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glTranslatef(-.3,0,0); glutSolidSphere(0.5,50,50); glTranslatef(.5,0,0); glutSolidCube(1.0); glPopMatrix(); glFlush(); } void mouse(int button, int state, int x, int y) { exit(0); } main(int argc, char **argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(500,500); glutCreateWindow("GLUT example"); glutDisplayFunc(display); glutMouseFunc(mouse); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); glClearColor(1.0,1.0,1.0,1.0); glMatrixMode(GL_PROJECTION); glRotatef(-140.0,1.0,1.0,0.0); glutMainLoop(); }