Picking Example Code Request

New Message Reply Date view Thread view Subject view Author view

Felix Shung (shung++at++ernie.arc.nasa.gov)
Mon, 19 Sep 94 15:41:35 -0700


        I am trying to create a scene which simulates what can be seen
through 3 cockpit windows. The code is based on the example "perfly"
provided by the Performer 1.2. The 3 channels are initialized in the
"InitChannel" as following:

        for (i=0; i< NumChans; i++){
                Chan[i] = pfNewChan(pfGetPipe(0));
        }

        pfuConfigMCO(Chan, NumChans);

        ViewState->masterChan = Chan[ChanOrder[1]];
        ViewState->leftChan = Chan[ChanOrder[0]];
        ViewState->rightChan = Chan[ChanOrder[2]];

            /* Attach channels to master channel to form a channel group. */
            for (i=0; i< NumChans; i++)
                if (Chan[i] != ViewState->masterChan)
                    pfAttachChan(ViewState->masterChan, Chan[i]);

            /* define the offset angles for the left and right screen */
            if(ViewState->displayMode != MCO_MODE0){
                /* Set each channel's viewing offset */
                pfSetVec3(xyz, 0.0f, 0.0f, 0.0f);
                pfSetVec3(hpr, OFFSET_ANGLE, 0.0f, 0.0f);
                pfChanViewOffsets(ViewState->leftChan, xyz, hpr);
                pfSetVec3(hpr, -OFFSET_ANGLE, 0.0f, 0.0f);
                pfChanViewOffsets(ViewState->rightChan, xyz, hpr);
            }

            /* set up the master(center screen ) channel */

            /* Set the callback routines for the pfChannel */
            pfChanCullFunc(ViewState->masterChan, CullFunc);
            pfChanDrawFunc(ViewState->masterChan, DrawFunc);

            /* Attach the visual database to the center */
            pfChanScene(ViewState->masterChan, ViewState->scene);

            /* Attach the EarthSky model to the center */
            pfChanESky(ViewState->masterChan, ViewState->eSky);

            /* Initialize the near and far clipping planes */
            pfChanNearFar(ViewState->masterChan, ViewState->near, ViewState->far);

            /* Vertical FOV is matched to window aspect ratio. */

            pfChanAutoAspect(ViewState->masterChan, PFFRUST_CALC_VERT);
            pfMakeSimpleFrust(ViewState->masterChan, ViewState->fov);

            /* Initialize the viewing position and direction */
            pfChanView(ViewState->masterChan, ViewState->initView.xyz,
                        ViewState->initView.hpr);

        *********************************************

        and the viewpoint and direction of the masterChan is updated
         once per frame in the realtime loop by using

        pfChanView(...)

        Somehow, all the previous definitions are lost in the real time
and the viewport and fov are default value( ie. fov = 45.0....). Can
anybody can give me any suggestion what goes wrong?

                ViewState is a structre variable defined in Shared memory.

                        Felix
.


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:50:33 PDT

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