ZB limits & Overlaid channels

New Message Reply Date view Thread view Subject view Author view

Michael Boccara (boccara++at++MIT.EDU)
Fri, 03 Apr 1998 14:20:34 -0800


Hi Performers,

For my space application, I have to use a very large Near/Far range : 1m/1e6km.
I chose to superpose 2 channels, sharing all attributes except near/far and draw
callback.
ChanFG : N = 1m F = 10km
ChanBG : N = 10km F = 1e6km
Better than a long speech, my piece of code is at the end of the message.

If I used only 1 channel, it would draw all the scene.
While my 2 channels draw 2 complementary parts of the scene, using draw
traversal masks.
So we should have the same graphic load...

BUT using 2 superposed channels is almost twice longer than using only 1 channel
!!!

Question :
1/ Why does it take longer than using only 1 channel ?
2/ What does happen in the pfDraw() function that is uselessly repeated between
the 2 channels ?
3/ How come can I call twice pfDraw() without any argument, into each draw
callback, letting Performer guess that it is for 2 separate channels ?

I am using Performer 2.1 on an Onyx RE2, IRIX 6.2, 2 CPUs, 1 Pipe.

Thanks for carrying me into the secrets of the depths of Performer...
Hope I was clear in my message...

Mike

Code :

static void
InitChannel(pfPipe* pipe)
{
  Shared->chanBG = new pfChannel(pipe);
  Shared->chanFG = new pfChannel(pipe);
  Shared->chanBG->attach(Shared->chanFG);
  Shared->chanFG->setShare(PFCHAN_FOV |
                           PFCHAN_VIEW |
                           PFCHAN_VIEW_OFFSETS |
                           PFCHAN_SCENE |
                           PFCHAN_SWAPBUFFERS |
                           PFCHAN_SWAPBUFFERS_HW |
                           PFCHAN_APPFUNC |
                           PFCHAN_CULLFUNC |
                           PFCHAN_VIEWPORT);
   
  // attaching the common pfScene
  Shared->chanFG->setScene(Shared->scene);

  // Customize pfDraw()
  Shared->chanFG->setTravFunc(PFTRAV_DRAW, drawFGChannel);
  Shared->chanBG->setTravFunc(PFTRAV_DRAW, drawBGChannel);

  // complementary clipping planes
  Shared->chanFG->setNearFar(.1e-3f, 10.0f);
  Shared->chanBG->setNearFar(10.0f, 1e6f);
   
  // chanFG is for Foreground Scene Group
  // chanBG is for Background Scene Group
  Shared->chanFG->setTravMask(PFTRAV_DRAW, FG_MASK);
  Shared->chanBG->setTravMask(PFTRAV_DRAW, BG_MASK);
}

// 2 draw callbacks
//
static void
drawBGChannel(pfChannel *bgchan, void *)
{
  // earthsky color/depth clear
  bgchan->clear();

  // 1st call to pfDraw
  pfDraw();

  if (Shared->drawStats == 1)
    bgchan->drawStats();
}

static void
drawFGChannel(pfChannel *fgchan, void *)
{
  // ONLY depth clear
  pfClear(PFCL_DEPTH, NULL);

  // 2nd call to pfDraw
  pfDraw();

  if (Shared->drawStats == 1)
    fgchan->drawStats();
}

-- 
Michael Boccara / +1 (617) 253 00 05 / boccara++at++mit.edu
=======================================================================
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:57:11 PDT

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