Need more comments from scientific community on python-dev

Josh Marshall josh.p.marshall at
Tue Oct 31 16:51:16 CST 2006

On 11/31/06, Fernando Perez < at> wrote:

> Fernando Perez wrote:
> ps - one more thing.  This guy:
> has been rewriting the OpenGL bindings using ctypes, and I've seen
> posts from him about numpy (in his blog).  He might be able to
> contribute something...

I've been working on the OSX port and extensions for OpenGL-ctypes.  
(now released as PyOpenGL-3.00a, please test!). What Mike has done is  
define setuptools plugins to interface to different kinds of array  
data. The default type is ctypes arrays, or numpy arrays if numpy is  
installed. The data types handled are ctypes sized arrays, ctypes  
pointers, strings (read-only), and Python lists. (and old Numeric/ 
numarray via a non-default build.)

Summaries of development and usage, resp, are found:

Notes on array handling from the above:

> Perhaps the most complex mechanisms in OpenGL-ctypes are those  
> which implement the array-based operations which allow for using  
> low-level blocks of formatted data to communicate with the OpenGL  
> implementation.  OpenGL-ctypes preferred basic array implementation  
> is the (new) numpy reimplementation of the original Numeric Python.
> The array handling functionality provided within OpenGL-ctypes is  
> localised to the OpenGL.arrays sub-package.  Within the package,  
> there are two major classes, one (the FormatHandler) which  
> implements an interface to a way of storing data in Python, and  
> another (the ArrayDatatype) which models an OpenGL array format.   
> The ArrayDatatype classes use FormatHandlers to manipulate array- 
> compatible objects for use in the system.
and on FormatHandlers, for each of the datatypes I mentioned earlier:

> Each format handler is responsible for implementing an API that  
> ArrayDatatypes can use to work with the Python data-format.  Data- 
> formats can support a subset of the API, they only need to support  
> those aspects of the data-format which make sense.
Now, I haven't spent much time looking at these parts of OpenGL- 
ctypes, as they have just worked for me. I would think that it would  
be trivial to write a FormatHandler which uses the ndarray interface  
and data type description to use any object implenting it as an input  
for OpenGL. This would include things such as PIL images.

Mike, can you give us your opinion on how a standardised data type  
descriptor would be helpful for PyOpenGL? The PEP and some  
information about it can be found here:


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo

More information about the Numpy-discussion mailing list