[C++-sig] C++ float[4][4] in Python

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Wed May 24 06:48:05 CEST 2006


--- Hans Meine <hans_meine at gmx.net> wrote:

> On Saturday 20 May 2006 17:48, Mike Wyatt wrote:
> > float[4][4] array, which I need to make available to my PyOpenGL calls
> > (glLoadMatrix and glMultMatrix, specifically):
> >
> >     [snip]
> >
> > *I see two solutions to my problem:
> > *
> > 1) Find a way for Python to understand a float[4][4].
> This will not work with PyOpenGL AFAICS.
> 
> > 2) Instead of allocating five tuples everytime the matrix changes, can I
> > create my tuples in the class constructor, then simply set the values
> > when necessary?
> No, because Python tuples are immutable by definition.  (Actually, there is a
> 
> hackish way to do so IIRC, but that's not the way to go, and PyOpenGL would 
> still have to unpack the tuples.)
> 
> You will get best performance by exporting your own functions calling 
> glMultMatrix with the data from your matrix directly.  It's perfectly fine to
> 
> mix PyOpenGL with your own OpenGL calls (since OpenGL maintains just some big
> 
> state machines).  You just have to link to the library and that's it.

FWIW: That's exactly what I did about a year ago:

http://cci.lbl.gov/gltbx/

I didn't have much time to work on this, but the CVS is a bit more advanced
including utilities to compile in Unicode BDF fonts.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Cplusplus-sig mailing list