OpenGL

Mike C. Fletcher mcfletch at rogers.com
Mon Jan 23 02:23:22 EST 2006


seb.haase at gmail.com wrote:
> Does that mean PyOpenGL is based on ctypes ?
>   
PyOpenGL, the project with releases, binaries on most platforms, and 
lots of history is currently written in SWIG.  It was originally written 
in pure Python C-extension code, then Tarn rewrote it using SWIG a few 
years ago.  OpenGL-ctypes is in the PyOpenGL CVS repository, it's a 
ctypes re-re-implementation of the same Python API to OpenGL.  My 
intention is that the ctypes implementation will become the 3.0.0 
release when it is finished and optimised.  If there's time and enough 
interest I'll try to produce another maintenance release for 
PyOpenGL-SWIG, but I'm really quite tired of spelunking through dozens 
of levels of C-code macro expansions, so I'm not all that interested in 
working with the codebase.
> I thought is was using SWIG ?
> And on that note:  I have some (old) SWIG typemaps for numarray arrays
> that I'm using for many years.
>
> I was always wondering how difficult it would be for me to add them
> into PyOpenGL ?
>   
Likely difficult, for the SWIG version.  You might be able to 
*substitute* them quite readily for the Numpy mapping, but having the 
APIs support two different numeric systems requires some API to switch 
between them, which requires rewriting the (really-deeply-embedded) 
typemaps to support that.  The difficulty of doing that kind of change 
is part of what prompted me to rewrite the system in Python (using ctypes).
> So far I'm just using my own (one !) OpenGL function with that typemap
> to draw 60000 vertices in a vector linestrip. But I would like to not
> have to resort to "string conversion" when for example drawing 2D
> typemaps...
>
> Anyway, thanks a lot for PytOpenGL - my program (image analysis
> platform and microscope control) would not be possible without it.
> Sebastian Haase
>   
OpenGL-ctypes is designed with a fairly well abstracted array-handling 
API.  Basically any array type can be registered with handlers that let 
you tell the system how to do basic operations; get an array's size, 
shape, data-type, convert to a given data-format, build an "empty" array 
of a given size, that kind of thing.  I haven't written a numarray one 
yet, but it should be a fairly trivial change from the Numpy/scipy-core 
module.

Have fun,
Mike

-- 
________________________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com




More information about the Python-list mailing list