GLEWpy: Python Wrappings of the OpenGL Extension Wrangler

GLEWpy aims to bring advanced OpenGL extensions to Python. This will allow the Python OpenGL developer to use features such as fragment and vertex shaders and image processing on the GPU. It serves as a compliment to PyOpenGL and toolkits such as GLUT and SDL (pygame).

Latest Release: 0.7.4

Project Page -- Download (requires Pyrex >= and GLEW >=1.3.4)

Installation Notes:

Sample Usage:

>>> import sys
>>> from OpenGL.GL import *
>>> from OpenGL.GLUT import *
>>> from glew import *

# MUST have a GL context before initializing GLEW
>>> glutInit(sys.argv)
>>> glutInitWindowSize(512, 512)
>>> glutCreateWindow('GLEW Testing')

# Now initialize GLEW
>>> err = glewInit()
>>> if (err != GLEW_OK):
print 'Error loading glew:', glewGetErrorString(err)
print 'GLEW Version:', glewGetString(GLEW_VERSION)

# Now you can query extension availability in two ways.
>>> if (glewGetExtension('GL_ARB_shading_language_100') == GL_TRUE):
print 'You have OpenGL Shading Language Support'

# The faster method
# Note this is a function call, unlike GLEW's value check
>>> if GLEW_ARB_shading_language_100():
print 'You have OpenGL Shading Language Support'

All extension methods are defined whether you machine supports them or not.  Attempting to call an unsupported method OR calling a supported method before glewInit is called, will result in a GlewpyError being raised.  Glewpy acts as if no extensions are supported before glewInit is called, because attempting to run the methods before would yeild a segmentation fault.

Supported Extensions:

Notes: Many extensions are duplications or pre-cursors to standard OpenGL.  These will have low priority unless requested (see the FAQ for how to request).  GLX and WGL extensions require other API's, so wrapping their functionality will require access to these libraries.  How we do this will be decided when the GL extensions are mature enough.

Coding Conventions:


More Questions? E-mail us!


Author: Charles Moad <>

SourceForge Logo