On Fri, Dec 28, 2012 at 9:34 PM, robert <[email protected]> wrote:

> I am trying to uses pyODE together with pyglet (for 3d graphics).
> pyODE conveniently keeps track of the location and rotation of objects for
> me.
> So when it comes to drawing them I'd like to do something like:
>
> pos = body.getPosition()
> rot = body.getRotation()
> matrix = [rot[0], rot[3], rot[6], 0.0,
>              rot[1], rot[4], rot[7], 0.0,
>              rot[2], rot[5], rot[8], 0.0,
>              pos[0], pos[1], pos[2], 1.0]
>
> glMultMatrixd(matrix)
>
> When  I try this, I get the following error:
>   glMultMatrixd(matrix)
> ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: expected
> LP_c_double instance instead of list
>
> what is the right way to construct a matrix to be passed to
> glMultMatrixd?
>
> Cheers,
> Robert
>

You need to construct a ctypes array, rather than just a basic python
array. Something like this:

ctypesMatrix = (c_double*16)(*matrix)

-- 
Tristam MacDonald
Software Development Engineer, Amazon.com
http://swiftcoder.wordpress.com/

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to