http://opengl.org.ru/books/open_gl/chapter2/giroscop/giroscop.c
а вот перенесенный
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
#from OpenGL.GLAUX import *
def resize(width, height):
glViewport(0,0,width,height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glOrtho(-5.5, -5.5, 2.12)
gluLookAt(0,0,5, 0,0,0, 0,1,0)
glMatrixMode(GL_MODELVIEW)
def display():
time = 0
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glPushMatrix()
glRotated(time/2, 0.0, 1.0, 0.0)
glLineWidth(5.0)
glColor3f(1.0,0.0,0.0)
glBegin(GL_LINES)
glVertex3d(-0.3,0.0,0.0)
glVertex3d(1.5,0.0,0.0)
glEnd()
glPushMatrix()
glRotated(2*time,1,0,0)
glTranslated(-0.3,0,0)
glColor3f(0,0,1)
glPushMatrix()
glRotated(90,0,1,0)
glLineWidth(1)
auxWireTorus(0.2, 0.7)
glPopMatrix()
glLineWidth(7)
glColor3f(0,1,0)
glBegin(GL_LINES)
glVertex3d(0,0,0)
glVertex3d(0,1,0)
glVertex3d(0,0,0)
glVertex3d(0,-0.5,1)
glVertex3d(0,0,0)
glVertex3d(0,-0.5,-1)
glEnd()
glPopMatrix()
#glPopMatrix()
while time < 100:
time = time+1
time+1
glutSwapBuffers()
pos = [3,3,3,1]
dir_ = [-1,-1,-1]
def main():
glutInitWindowPosition(0,0)
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE)
glutInitWindowSize(800, 600)
glutCreateWindow("Anim")
glutDisplayFunc(display)
glutReshapeFunc(resize)
glEnable(GL_ALPHA_TEST)
glEnable(GL_COLOR_MATERIAL)
glEnable(GL_LIGHT0)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glLightfv(GL_LIGHT0, GL_POSITION, pos)
glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, dir_)
glutMainLoop()
main()
ЗЫ В ориинальном коде импортируется библиотека GLAUX - видимо ее уже не существует?