simple pyglet window for opengl


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.