from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * import sys def ecran(): glClearColor(0,0,0,0) glClear(GL_COLOR_BUFFER_BIT) glMatrixMode(GL_MODELVIEW) glLoadIdentity() gluLookAt(0.4,0.4,3.,0.,0.,0.,0.,1.,0.) glColor3d(1,0,0) glutWireCube(1.0) glTranslatef(0.,0.7,0.) glutSolidTeapot(0.3) glFlush() def reshape(*args): glViewport(0,0,args[0],args[1]) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(60.0,float(args[0])/args[1],1.,10.) def main(): glutInit(sys.argv) glutInitDisplayMode(GLUT_RGBA) glutInitWindowPosition(100,100) glutInitWindowSize(320,320) glutCreateWindow("Une theiere") glutDisplayFunc(ecran) glutReshapeFunc(reshape) glutMainLoop() main()