I'm not sure if this is right but I think what you need is a [4][4] matrix
of pointers to double but with MScriptUtil what you are creating is a [16]
array... so the matrixToDouble should be in this form:

matrixToDouble = [ [4],[4],[4],[4] ]

and you need to use MScriptUtil.asDoublePtr() for each element

but again I'm not sure, its a bare guess...

On Mon, Jun 29, 2009 at 7:03 PM, David Corral <[email protected]> wrote:

>
> This is what i got until now:
>
> #get camera inverse matrix
>                        camView = om.MDagPath()
>                        view.getCamera( camView )
>                        cameraInverseMatrix =
> camView.inclusiveMatrix().inverse()
>
>                        #convert matrix to MGLfloat *
>                        proMat = cameraInverseMatrix
>                        matrixToDouble =
> [om.MScriptUtil.getDoubleArrayItem(proMat[0],0),
> om.MScriptUtil.getDoubleArrayItem(proMat[0],1),
> om.MScriptUtil.getDoubleArrayItem(proMat[0],2),
> om.MScriptUtil.getDoubleArrayItem(proMat[0],
> 3),om.MScriptUtil.getDoubleArrayItem(proMat[1],0),
> om.MScriptUtil.getDoubleArrayItem(proMat[1],1),
> om.MScriptUtil.getDoubleArrayItem(proMat[1],2),
> om.MScriptUtil.getDoubleArrayItem(proMat[1],
> 3),om.MScriptUtil.getDoubleArrayItem(proMat[2],0),
> om.MScriptUtil.getDoubleArrayItem(proMat[2],1),
> om.MScriptUtil.getDoubleArrayItem(proMat[2],2),
> om.MScriptUtil.getDoubleArrayItem(proMat[2],
> 3),om.MScriptUtil.getDoubleArrayItem(proMat[3],0),
> om.MScriptUtil.getDoubleArrayItem(proMat[3],1),
> om.MScriptUtil.getDoubleArrayItem(proMat[3],2),
> om.MScriptUtil.getDoubleArrayItem(proMat[3],3)]
>
>                        suFloatArray = om.MScriptUtil()
>                        suFloatArray.createFromList( matrixToDouble, 16 )
>                        suPointer = suFloatArray.asFloatPtr()
>
>                        test = glFT.glGetFloatv(omRender.MGL_MODELVIEW,
> suPointer )
>
>                        #set camera matrix to opengl
>                        glFT.glPushMatrix()
>                        #glFT.glLoadMatrixd( test )#>>>CRASH
>
>                        #start render
>                        glFT.glBegin( omRender.MGL_LINES )
>                        for i in range(0,360,10):#step 10
>                                rad = (i*2*math.pi)/360;
>
>  glFT.glVertex2f(math.sin(rad)*radius,math.cos(rad)*radius)
>                        glFT.glEnd()
>
> But it crash when i'm applying the matrix: "glFT.glLoadMatrixd( test )"
> >
>


-- 
E.Ozgur Yilmaz
Senior Technical Director
www.ozgurfx.com

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to