# # glshpere.py # (c) Neil Gershenfeld 2/5/05 # draw a sphere with GLUT # from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * import sys def display(): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glutSolidSphere(0.8,50,50) glFlush() def mouse(*args): sys.exit() glutInit(()) glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH) glutInitWindowSize(500,500) glutCreateWindow("GLUT sphere 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()