Skip to content

Instantly share code, notes, and snippets.

@adamlwgriffiths
Created February 13, 2013 11:59
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 adamlwgriffiths/4944127 to your computer and use it in GitHub Desktop.
Save adamlwgriffiths/4944127 to your computer and use it in GitHub Desktop.
Example of creating an OpenGL core profile (3.2) in pyGLFW. This uses patches from my fork (https://github.com/adamlwgriffiths/pyglfw) which will hopefully be integrated soon.
import glfw
from OpenGL.GL import *
glfw.Init()
glfw.OpenWindowHint( glfw.OPENGL_VERSION_MAJOR, 3);
glfw.OpenWindowHint( glfw.OPENGL_VERSION_MINOR, 2)
glfw.OpenWindowHint( glfw.OPENGL_FORWARD_COMPAT, GL_TRUE)
glfw.OpenWindowHint( glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
glfw.OpenWindow(
800, 600,
8, 8, 8,
8, 24, 0,
glfw.WINDOW
)
glfw.SetWindowTitle( "GLFW" )
def run():
while True:
if glfw.GetKey(glfw.KEY_ESC) == glfw.GLFW_PRESS:
break
draw()
glfw.SwapBuffers()
def draw():
glClearColor( 0.5, 0.5, 0.5, 1.0 )
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT )
print glGetString( GL_VERSION )
run()
glfw.Terminate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment