Created
September 24, 2013 12:45
-
-
Save davepape/6684152 to your computer and use it in GitHub Desktop.
basic OpenGL transformations
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
from pyglet.gl import * | |
window = pyglet.window.Window() | |
triangle = pyglet.graphics.vertex_list(3, ('v2f', [0,0, 40,0, 80,80])) | |
@window.event | |
def on_draw(): | |
glClear(GL_COLOR_BUFFER_BIT) | |
glLoadIdentity() | |
glTranslatef(300,200,0) | |
glColor3f(1,0,0) | |
triangle.draw(GL_TRIANGLES) | |
glColor3f(0,1,0) | |
glTranslatef(80,80,0) | |
glRotatef(45, 0, 0, 1) | |
glTranslatef(-80,-80,0) | |
triangle.draw(GL_TRIANGLES) | |
pyglet.app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment