Bernard Leclerc (bleclerc++at++cae.ca)
Wed, 29 May 1996 12:58:14 -0400
> I'm in a position where I need to fade a view of a scene to black. I'm
> used to using the OpenGL calls to set the pixel transfer scale factors
> to my required colour scale. If I do this in Performer 2.0 it looks like
> textured objects are the only ones to be scaled.
>
> Is there any Peformer equivalent, or has anyone found a sensible
> alternative?
>
> At the moment I am trying the approach of scaling the light intensities
> but this is beginning to get messy since I need to follow various
> material properties and more.
>
> The application is intended to work with any geometry presented to it.
Graham,
Have you tried using the accumulation buffer? Here is an example in C++ and
IrisGL. I'm sure there's an equivalent with OpenGL.
// global var.
float fade_factor = 1.0f;
// DrawFunc() -- Channel DRAW process callback
static void drawFunc(pfChannel* chan, void*)
{
chan->clear();
pfDraw();
acbuf(AC_CLEAR_ACCUMULATE, 1.0f);
acbuf(AC_RETURN, fade_factor); // 0 <= fade_factor <= 1
}
// PipeConfigFunc() -- To configure the Frame Buffer
static void PipeConfigFunc(pfPipeWindow* pw)
{
pw->open();
acsize(12);
gconfig();
}
// Main() -- Main program
void main (int argc, char *argv[])
{
...
pfPipeWindow* pw = new pfPipeWindow(p);
pw->setConfigFunc(PipeConfigFunc);
pw->config();
...
pfChannel* chan = new pfChannel(p);
chan->setTravFunc(PFTRAV_DRAW,drawFunc);
...
while (!done) {
...
pfSync();
...
fade_factor = ...
pfFrame();
...
}
pfExit();
}
Of course, this works if you have a hardware accumulation buffer. On the RE2,
you can set the acsize to 12, 16 or 24. On other platform, refer to the man
page.
There's a cost associated with the use of the accumulation buffer. Here are the
timing I obtained on a RE2/MCO running IRIX 5.3 and Performer 2.0 on a VGA
channel:
AC_CLEAR_ACCUMULATE = 1.5 ms
AC_RETURN = 2.5 ms
--------
Total = 4.0 ms
I hope this suggestion is of help to you...
Good luck Graham.
--
___/ | ___/ Bernard Leclerc e-mail: bleclerc++at++cae.ca
/ / | / Systems Engineer voice: +1 514 341 2000
/ / | __/ CAE Electronics Ltd. extension 2275
/ / | / 8585 Cote De Liesse fax: +1 514 340 5496
/ ____ | / P.O. Box 1800
_____/ _/ _| _____/ Saint-Laurent, Quebec, Canada, H4L-4X4
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer.html
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:52:55 PDT