Posted By

iamok on 05/06/09


Tagged

opengl pyglet


Versions (?)

simple pyglet window for opengl


 / Published in: Python
 

  1. from pyglet.gl import *
  2.  
  3. # Direct OpenGL commands to this window.
  4. window = pyglet.window.Window()
  5.  
  6. @window.event
  7. def on_draw():
  8. glClear(GL_COLOR_BUFFER_BIT)
  9. glLoadIdentity()
  10. glBegin(GL_TRIANGLES)
  11. glVertex2f(0, 0)
  12. glVertex2f(window.width, 0)
  13. glVertex2f(window.width, window.height)
  14. glEnd()
  15.  
  16. pyglet.app.run()

Report this snippet  

You need to login to post a comment.