Last active
January 10, 2017 18:15
-
-
Save davepape/6527330 to your computer and use it in GitHub Desktop.
a triangle, using a pyglet vertex_list
This file contains 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
# triangle.py | |
# by Dave Pape, for DMS 423 | |
# | |
# Basic pyglet/OpenGL program to draw a single red triangle using a vertex list | |
from pyglet.gl import * | |
window = pyglet.window.Window() | |
# Create the vertex_list - 3 vertices, with 2-dimensional position data, and nothing else | |
vlist = pyglet.graphics.vertex_list(3, ('v2f', [0,0, 400,50, 200,300])) | |
@window.event | |
def on_draw(): | |
glClear(pyglet.gl.GL_COLOR_BUFFER_BIT) | |
glColor3f(1,0,0) | |
vlist.draw(GL_TRIANGLES) | |
pyglet.app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
15 glClear(pyglet.gl.GL_COLOR_BUFFER_BIT)
can be replaced with:
15 glClear(GL_COLOR_BUFFER_BIT)
because all
pyglet.gl
has already been imported