Re: [info-performer] mirror a channel left-right

New Message Reply Date view Thread view Subject view Author view

From: R Krijnen (Krijnen++at++fel.tno.nl)
Date: 11/06/2002 07:18:23


Steffen,

To quote Angus

> You could scale -1 in eyespace X and reverse face culling to do this.

> Fortunately OpenGL has a winding definition which allows you to
> determine whether clockwise or anticlockwise is considered to be front
> facing.

> glFrontFace in conjunction with a pfDCS at the top of your scene graph
> or a draw callback scaling operation would do the trick.

Or look at this code sniplet

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 *)
{
    if (Shared->mirror == 1) {
        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

Steffen wrote:

> Hi,
> What is the easiest way to mirror the view left-right for a "rear-view mirror" channel?
>
> pfChanFOV(chan, horiz, vert) takes only positive values I mean.
>
> Steffen
>
> -----------------------------------------------------------------------
> List Archives, Info, FAQ: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
> -----------------------------------------------------------------------

--
Senior Scientific Researcher  --  Command & Control and Simulation
TNO Physics and Electronics Laboratory
Oude waaldorperweg 63  --  PO Box 96864, 2509 JG the Hague
The Netherlands  --  http://www.tno.nl/instit/fel/ebf
T +31 (0)70 374 02 78  --  F +31 (0)70 374 06 52


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Nov 06 2002 - 07:19:21 PST

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