On Fri, Apr 3, 2009 at 2:20 AM, Mike C. Fletcher <mcfletch@vrplumber.com> wrote:
Peter Gebauer wrote:
Hi Mike!

Will PyOpenGL 3.x be rewritten in the future to use SWIG, Pyrex or
Python extensions written in C to improve performance? Is there a possibility
of mixing ctypes with Python extensions in C for the more critical parts?
 
The OpenGL_accelerate module is written in Cython (~= Pyrex) to improve performance.  Yes, you can fairly freely mix C/Cython/Pyrex coded OpenGL-using extensions with PyOpenGL code.  The current GL context is used by all PyOpenGL calls (well, the ones that don't explicitly specify contexts, such as those in GLUT or GLX).

As for rewriting the core library, I doubt *I* will do another rewrite. But the fact is that someone could easily generate a new Cython/Pyrex wrapper without breaking a sweat.  They would just then need to do all the project management and maintenance on the code-base, and I quit working on the SWIG code-base because of the maintenance headaches, so it's not really something I want to go back to.

The use of ctypes means that we should eventually be able to run on all of Jython, PyPy, IronPython, Unladen Swallow and CPython with the core Python+ctypes-only implementation.  Interpreters that actually *use* the ctypes annotations (PyPy) may eventually be able to use the fact of using ctypes to generate almost-C-level performance from the code.


A funny side note is that ironpython can more easily run CPython compiled extensions than ctypes code at the moment.  This is done by emulating the CPython API.


cu,