Вот код.
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
def InitGL(Width, Height):
glClearColor(0.0, 0.0, 0.0, 0.0)
#gluLookAt(-0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
#glClearDepth(1.0)
#glDepthFunc(GL_LESS)
#glEnable(GL_DEPTH_TEST)
#glEnable(GL_LIGHTING)
#glEnable(GL_LIGHT0)
#glEnable(GL_COLOR_MATERIAL)
def ReSizeGLScene(Width, Height):
if Height == 0: Height = 1
glViewport(0, 0, Width, Height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
def DrawGLScene():
glClear(GL_COLOR_BUFFER_BIT)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
gluLookAt(-0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
glPushMatrix()
glTranslatef(-1.0, 0.0, 0.0)
glEnable(GL_POINT_SMOOTH)
glPointSize(3)
glBegin(GL_POINTS)
glVertex3f(0.0, 0.0, 0.0)
glEnd()
glPopMatrix()
glTranslatef(1.0, 0.0, 0.0)
glBegin(GL_LINE_LOOP)
glVertex3f(0.4, 0.5, 0.6)
glVertex3f(0.2, 0.4, 0.1)
glEnd()
glutSwapBuffers()
def KeyPressed(*args):
if args[0] == "\033": sys.exit()
def main():
glutInit(sys.argv)
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH)
glutInitWindowSize(800, 600)
glutInitWindowPosition(0, 0)
glutCreateWindow("Will it ever works properly at last?")
glutDisplayFunc(DrawGLScene)
glutIdleFunc(DrawGLScene)
glutReshapeFunc(ReSizeGLScene)
glutKeyboardFunc(KeyPressed)
InitGL(800, 600)
glutMainLoop()
main()