Re: Creating GL MVIEWING matrix from Performer's model and view matrices?

New Message Reply Date view Thread view Subject view Author view

Hansong Zhang (zhangh++at++cs.unc.edu)
Thu, 1 Aug 1996 13:27:54 -0400 (EDT)


Hi,

The GL viewing matrix (glViewMat) can be created from the performer
viewing matrix (pfViewMat) in the following way:

glViewMat.invertFull(pfViewMat);
glViewMat.postRot(glViewMat, -90, 1, 0, 0);

Hope this helps.

Hansong

-------------------------------------------------------------
Hansong Zhang \ zhangh++at++cs.unc.edu
Walkthrough Group \ http://www.cs.unc.edu/~zhangh
Department of Computer Science \ (919)962-1835 (O)
UNC-Chapel Hill \ (919)929-4851 (H)

"I create abstract systems from pure information, Albert. I'm
a *programmer*... Quantum nonlocality is a bug." -- God
-------------------------------------------------------------

>
>
> I'm trying without success to create the IRIS GL model/view (MVIEWING) matrix
> from Performer's model matrix and viewing matrix (which are kept seperate).
>
> In a node draw callback I get the Performer matrices by doing this:
>
> pfGetModelMat(modelMat);
> pfGetViewMat(viewMat);
>
> After pfDraw is finished I want to recreate the exact same MVIEWING GL matrix
> that was in effect during the node draw callback.
>
> So I tried doing something like this:
>
> // first take into account the change in coordinate system from Performer
> // to IRISGL which is a rotation of -90 degrees around the X axis
> pfMatrix rot;
> rot.makeRot(-90.0f,1.0f,0.0f,0.0f);
>
> pfMatrix mat;
> // multiply all the matrices together
> mat = rot * modelMat * viewMat;
>
> // set this matrix as the IRIS GL ModelView matrix
> mmode(MVIEWING);
> pfLoadMatrix(mat);
>
> ...then draw my own stuff
>
> Obviously I'm doing something wrong because it is not working as espected.
> The final matrix is different than the one that was in effect during the draw
> callback (I compared them). I've tried switching the order of multiplication
> without improvements.
>
> If instead of saving the Performer's matrices in the draw callback I save
> the current GL MVIEWING matrix by doing:
>
> getmatrix(glMat);
>
> and then restoring it later with:
>
> mmode(MVIEWING);
> loadmatrix(glMat);
>
> It works.
>
> The problem is that is not a satisfactory solution for my application.
> I really need to be able re-create the MVIEWING matrix from Performer's
> internal matrices.
>
> I'm sure other people have tried this before so any help would be appreciated.
>
> I suspect that Performer builds the MVIEWING matrix in a different way than
> I'm expecting.
>
>
>
> --
> Nicolas Gauvin CAE Electronics Ltd., 8585 Cote De Liesse
> Software Developer Saint-Laurent, Quebec, Canada, H4L-4X4
> 3-D Graphics Applications tel: +1 514 341 2000 extension 2275
> nicolas++at++cae.ca fax: +1 514 340 5496
> =======================================================================
> List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:53:18 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.