Created
September 5, 2013 16:41
-
-
Save davepape/6452756 to your computer and use it in GitHub Desktop.
Minimal pyglet/OpenGL program
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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