Created
February 13, 2013 11:59
-
-
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.
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
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