from pyglet.gl import * # Direct OpenGL commands to this window. window = pyglet.window.Window() #glShadeModel (GL_FLAT); #glDepthFunc(GL_LEQUAL) #glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) #glEnable(GL_DEPTH_TEST) #@window.event #def on_resize(w,h): # glMatrixMode(GL_PROJECTION) # glLoadIdentity() # #gluPerspective(45, 1.0 * 800 / 600, 0.1, 100.0) # glMatrixMode (GL_MODELVIEW) # glViewport (0, 0, w, h) @window.event def on_draw(): glClearColor (0.0, 0.0, 0.0, 0.0) glClear(GL_COLOR_BUFFER_BIT) glLoadIdentity() glBegin(GL_TRIANGLES); glColor3f(1.0, 1.0, 1.0) glVertex2f( 0, 0) glVertex2f( 1, 0) glVertex2f( 1, 1) glEnd() glFinish() pyglet.app.run()