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
>>> import sys |
void glColor3i(GLint r, GLint g, GLint b) -->
glColor3i(r, g, b) # Easy enough
void glColor3iv(GLint* rgb) -->
glColor3iv([r, g, b]) # Any iterable
void glGetParameterfv(GLenum target, GLenum pname, GLfloat* params) -->
params glGetParameterfv(target, pname) # Can't pass pointers, so value returned
void glTexImage1D(GLenum target, GLint level, GLint internalFormat, GLsizei width, \
GLint border, GLenum format, GLenum type, const GLvoid* pixels) -->
glTexImage1D(target, level, internalFormat, width, border, format, type, pixels)
# So what should be passed for pixels?
# The best way we have decided to handle a void pointer is by passing a byte string.
# This allows developers to use the module of their choice for textures and lut's.
# The most common uses will be to pass PIL's Image.tostring() and NumArray's array.tostring().
Author: Charles Moad <cmoad@users.sourceforge.net> |