[info-performer] Problem removing pfEarthSky from pfChannel group in Perf 3.2

Date view Thread view Subject view Author view

From: Micah Zarnke (micah.zarnke++at++drdc-rddc.gc.ca)
Date: 03/07/2006 12:43:58


I've just upgraded from Performer 3.1 to Performer 3.2 and am suddenly
having a problem removing pfEarthSky from pfChannel groups. In
Performer 3.1, removing earthsky from one channel had no effect on other
channels in the group. With the same code in Performer 3.2, removing
earthsky from one channel seems to remove it from every channel in the
group, regardless of the pfChannel::setShare() settings. Has anybody
else encountered this problem? Am I doing something wrong?

The following psudo code summarizes the problem.
-------
   pfChannel * pChan1 = new pfChannel(pPipe);
   pChan1->setESky( new pfEarthSky() );

   pfChannel *pChan2 = new pfChannel(pPipe);
   pChan2->setESky( new pfEarthSky() );

   pChan2->attach( pChan1 );
   pChan1->setShare( pChan2->getShare() & ~PFCHAN_EARTHSKY ); // <- do
not share earthsky

   pChan1->setESky( NULL ); // <- this seems to remove earth/sky from
BOTH channels in Perf 3.2
---------

I've written a short test program to replicate the situation. It is
taken from the sample multichan.C code included with Performer 3.2. In
Performer 3.1 this code draws 1 channel black and the other channel
using earthsky (desireable behaviour). In Performer 3.2 it draws both
channels black (undesireable behaviour).

#include <Performer/pf/pfChannel.h>

int
main (int argc, char *argv[])
{
    pfInit();
    pfConfig();

    // Configure and open GL window
    pfPipe *p = pfGetPipe(0);
    pfPipeWindow *pw = new pfPipeWindow(p);
    pw->setName("OpenGL Performer");
    pw->setOriginSize(0, 0, 600, 300);
    pw->config();

    // create and configure earthsky
    pfEarthSky * pESky = new pfEarthSky();
    pESky->setColor( PFES_SKY_TOP, 1.0f, 1.0f, 0.0f, 1.0f );
    pESky->setColor( PFES_GRND_NEAR, 0.1f, 0.4f, 0.2f, 1.0f );
    pESky->setMode( PFES_BUFFER_CLEAR, PFES_SKY_GRND );

    pfChannel * chan1 = new pfChannel(p);
    chan1->setESky( pESky );

    pfChannel * chan2 = new pfChannel(p);
    chan2->setESky( pESky );

    // setup the viewport
    chan1->setViewport(0.0f, 0.5f, 0.0f, 1.0f);
    chan2->setViewport(0.5f, 1.0f, 0.0f, 1.0f);

    // make the channels part of a group, but don't share earthsky
    chan2->attach( chan1 );
    chan1->setShare( chan1->getShare() & ~PFCHAN_EARTHSKY );

    // setup channels in the group
    pfScene *scene = new pfScene;
    chan1->setScene(scene);
    chan1->setNearFar(1.0f, 100.0f);
    chan1->setFOV(45.0f, 0.0f);

    // setup the viewpoint
    pfCoord view;
    view.hpr.set(0.0f, 0.0f, 10);
    view.xyz.set(0.0f, 0.0f, 20.0f );
    chan1->setView(view.xyz, view.hpr);

//-> // ******************************************************************
//-> // In Performer 3.1, this removes the pfEarthSky from channel 1 only.
//-> // In Performer 3.2, this removes the pfEarthSky from all channels
//-> // (regardless of the chan1->setShare(~PFCHAN_EARTHSKY) ) settings
//-> // above).
//-> // ******************************************************************
    chan1->setESky( NULL );

    // Simulate for twenty seconds.
    float t = 0;
    while (t < 20.0f)
    {
        pfSync();
        pfFrame();
        t = pfGetTime();
    }

    // Terminate parallel processes and exit.
    pfExit();

    return 0;
}

----------------------------------------

thanks in advance,
micah

Micah Zarnke
Simulation Developer
DRDC-Toronto,
Toronto, ON
Canada


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Mar 07 2006 - 12:44:17 PST