Re: Fading a view

New Message Reply Date view Thread view Subject view Author view

Morten Eriksen (mortene++at++pvv.unit.no)
Wed, 29 May 1996 17:29:59 +0200 (MET DST)


On Wed, 29 May 1996, Graham Jones wrote:

> I would appreciate it if someone were able to make a suggestion here.
>
> 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?

Here's a quick hack which I made that'll fade your screen to any color
you want. It works by drawing a rectangle on top of the
Performer-drawn 3D graphics on the end of each frame, so call this
function in your PostDraw(). The fading is done by modifying the
fadeval value from 0x00bbggrr to 0xffbbggrr, where bbggrr is the color
which you want to fade to. I don't know if it'll be of any help, but
it might so here it is:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-

void DrawFullRectangle(unsigned long fadeval)
{
  static pfMatrix tempmat;
  static short clrt[] = { 0x80, 0x00, 0x00, 0x80 };

  clrt[0] = (short)(fadeval & 0x000000ff);
  clrt[1] = (short)((fadeval & 0x0000ff00) >> 8);
  clrt[2] = (short)((fadeval & 0x00ff0000) >> 16);
  clrt[3] = (short)((fadeval & 0xff000000) >> 24);

  c4s(clrt);
   
  zfunction(ZF_ALWAYS);
  zwritemask(0x0);
  pfPushState();
  pfBasicState();
  blendfunction(BF_SA, BF_MSA);
  mmode(MPROJECTION);
  getmatrix(tempmat);
  mmode(MVIEWING);
   
  ortho2(0.0, 1.0, 0.0, 1.0);
   
  pfPushMatrix();
  pfLoadMatrix(idmat);

  rectf(0.0, 0.0, 1.0, 1.0);
   
  pfPopMatrix();
   
  mmode (MPROJECTION);
  loadmatrix(tempmat);
  mmode (MVIEWING);
  blendfunction(BF_ONE, BF_ZERO);
  pfPopState();
  zfunction(ZF_LEQUAL);
  zwritemask(0xffffffff);
}

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-

Best regards,
Morten Eriksen
=======================================================================
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


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:52:55 PDT

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