Jan Grund Pedersen (jan++at++clarus.se)
Mon, 30 Sep 1996 08:50:57 +0100
At 13:33 1996-09-27 -0400, you wrote:
>Jan Grund Pedersen wrote:
>
>> 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
>
>
-- Jan Grund-Pedersen Prosolvia Clarus AB Gardav 1 E-mail: jan++at++clarus.se S-412 50 Goteborg Voice: +46 31 703 51 00 Sweden Fax: +46 31 703 51 20 Mobile: +46 707 811 655======================================================================= 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:39 PDT