From: R. Krijnen (Krijnen++at++fel.tno.nl)
Date: 06/23/2000 08:59:25
Dimi
from the archives.
attached mail follows:
Hans,
we implemented the (rear view) mirror using a cull callback to scale the
view matrix
and a draw callback to reverse face culling.
the code looks something like this...
static void CullChannel2 (pfChannel *channel, void *)
{
pfMatrix mat;
channel->getViewMat (mat);
mat.preScale (-1.0, 1.0, 1.0, mat); // vertical mirror
channel->setViewMat (mat);
}
static void DrawChannel2 (pfChannel *channel, void *)
{
....... some code
if (Shared->mirror == 1) {
glFrontFace (GL_CW);
}
// invoke Performer draw-processing for this frame
pfDraw();
if (Shared->mirror == 1) {
glFrontFace (GL_CCW);
}
.... rest of the code
}
Robbert Krijnen
Hans Palbøl wrote:
> Hi,
>
> I'm having trouble setting up a channel as a rear view mirror. The
> problem is that the image is not mirrored. I tried to add a
> transformation with the following code:
>
> pfMatrix mat;
> mat.makeScale( -1.0, 1.0, 1.0 );
> pfFrustum fru;
> mirrorChan->getBaseFrust( &fru );
> mirrorChan->orthoXform( &fru, mat );
>
> but it didn't help. Btw. orthoXform should according to the man page be
> able to take a pfChannel directly, but that couldn't compile. I also
> tried to switch the left and right values in the setViewport call, but
> that's not allowed.
>
> Any help is much appreciated.
>
> Regards,
> Hans
>
> --
> Hans Palbøl
>
> "Jeg tror nok, han benyttede sig af
> de vilde trækfugle til at slippe bort"
> ----------------------------------------------------
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 08:59:48 PDT