All pastes #390962 Raw Edit

Untitled

public python v1 · immutable
·published 2007-03-11 20:17 UTC
rendered paste body
import OpenGLESCAPE = '\033'window = 0def InitGL(Width, Height):    glClearColor(0.0, 0.0, 0.0, 0.0)    glClearDepth(1.0)    glDepthFunc(GL_LESS)                    glEnable(GL_DEPTH_TEST)                    glShadeModel(GL_SMOOTH)                        glMatrixMode(GL_PROJECTION)    glLoadIdentity()                        gluPerspective(45.0, float(Width)/float(Height), 0.1, 100.0)    glMatrixMode(GL_MODELVIEW)def ResizeGLScene(Width,Height):    if Height == 0:        Height = 1    glViewport(0, 0, Width, Height)    glMatrixMode(GL_PROJECTION)    glLoadIdentity()    gluPerspective(45.0, float(Width)/float(Height), 0.1, 100.0)    glMatrixMode(GL_MODELVIEW)def DrawGLScene():        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)        glLoadEntity()        glutSwapBuffers()def keyPressed(*args):        if args[0] == ESCAPE:        glutDestroyWindow(0)        sys.exit()def main():    global window    glutInit("")    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH)    glutInitWindowSize(640, 480)    window = glutCreateWindow("Mots' first pyOpenGL-Window")    glutSetDisplayFuncCallback(DrawGLScene)    glutDisplayFunc()    glutSetIdleFuncCallback(DrawGLScene)    glutIdleFunc()    glutSetReshapeFuncCallback(ReSizeGLScene)    glutReshapeFunc()    glutSetKeyboardFuncCallback(keyPressed)    glutKeyboardFunc()    InitGL(640, 480)    glutMainLoop()print "Hit ESC key to quit."main()