Bernard Leclerc (bleclerc++at++cae.ca)
Fri, 27 Sep 1996 13:33:14 -0400
> I have three channels of totally 135 degrees FOV. I would like not to
> cull all three channels every frame (I don't move that rapidly), but
> just once every third frame and then draw "the same triangles" in
> between, to get better performance. How can I do this?
Here is one method:
void main ()
{
...
pfChannel* chan = new pfChannel(p);
chan->setTravFunc(PFTRAV_APP, appCallback);
chan->setTravFunc(PFTRAV_DRAW, drawCallback);
...
}
void appCallback(pfChannel* chan, void*)
{
if (pfGetFrameCount() % 3 == 0)
chan->setTravMode(PFTRAV_DRAW, PFDRAW_ON);
else
chan->setTravMode(PFTRAV_DRAW, PFDRAW_OFF);
}
void drawCallback(pfChannel* chan, void*)
{
chan->clear();
pfDraw();
if (acbuf_available) {
acbuf(AC_CLEAR_ACCUMULATE, 1.0f);
frontbuffer(TRUE);
acbuf(AC_RETURN, 1.0f);
}
else {
frontbuffer(TRUE);
int x0, y0, xs, ys;
chan->getOrigin(&x0, &y0);
chan->getSize(&xs, &ys);
rectcopy(x0, y0, x0 + xs -1, y0 + ys -1, x0, y0);
}
}
Note that turning off a channel prevents the CULL and DRAW stage from
processing the channel. It doesn't prevent a channel APP callback from
being called.
Since Performer is using a double buffer, you must copy the scene from the
current buffer (the back buffer) to the other one (the front buffer). From
my experience, it's faster to use the accumulation buffer then to use a
rectcopy().
Of course, this example is using IrisGL, I'll let you figure out the
OpenGL equivalent.
--
Bernard Leclerc CAE Electronics Ltd., 8585 Cote De Liesse
Technical Leader Saint-Laurent, Quebec, Canada, H4L-4X4
3-D Graphics Applications tel: +1 514 341 2000 extension 2275
bleclerc++at++cae.ca fax: +1 514 340 5496
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:53:38 PDT