Skip to content

Instantly share code, notes, and snippets.

@davepape
Created September 5, 2013 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davepape/6452756 to your computer and use it in GitHub Desktop.
Save davepape/6452756 to your computer and use it in GitHub Desktop.
Minimal pyglet/OpenGL program
# clear.py
# by Dave Pape, for DMS 423
#
# Minimal pyglet/OpenGL program. Demonstration of the basic structure
# of such a program.
# Opens a window and clears it to all red.
# Load pyglet's OpenGL interface
from pyglet.gl import *
# Open a window
window = pyglet.window.Window()
# Reminder: the drawing function must be named "on_draw", and
# defined as a window event decorator
@window.event
def on_draw():
glClearColor(1,0,0,0)
glClear(GL_COLOR_BUFFER_BIT)
def update(dt):
pass
pyglet.clock.schedule_interval(update,1/60.0)
pyglet.app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment