Performer & color_matrix_SGI

New Message Reply Date view Thread view Subject view Author view

Harri Kaimio (harri.kaimio++at++yle.fi)
Wed, 29 Jan 1997 14:00:17 +0200


Hi all Performer gurus!

I am afraid I have lost all hope of understanding, how Performer works
internally :-(

I am working on a project in which I need to change the color saturation
(perhaps also hue) of part of the scene graph over time. The way I have
planned to do it is by using the color matrix OpenGL extension. My
source code looks like this:

int
bwPreDraw( pfTraverser * )
{
  // draw callback to turn on color matrix stuff
  float colorMat[16];

  // set up the color matrix
  ...

  // Store current matrix mode
  int mmode[1];
  glGetIntegerv( GL_MATRIX_MODE, mmode );

  glMatrixMode( GL_COLOR );
  glLoadMatrixf( colorMat );
  glMatrixMode( mmode[0] );
  return PFTRAV_CONT;
}

int
bwPostDraw( pfTraverser * )
{
  // Turn off color matrixes
  int mmode[1];
  glGetIntegerv( GL_MATRIX_MODE, mmode );
  glMatrixMode( GL_COLOR );

  glLoadIdentity();
  glMatrixMode( mmode[0] );
  return PFTRAV_CONT;
}

...

// Set color matrix callbacks for a node
node->setTravFuncs( PFTRAV_DRAW, bwPreDraw, bwPostDraw )

...

OK, this kind of works - I can specify different color matrix for
different nodes and the results look correct, BUT I CANNOT ANIMATE THE
COLOR MATRIXES. If I change the color matrix used for a certain object
between frames, it makes no visible difference in the rendered picture -
it is always rendered using the color matrices specified in the first
frame of simulation. I have checked that my callbacks are really called
and correct color matrixes have been loaded for each frame.

Can someone wiser than me explain what is happening? The only
explanation I can think of is that perhaps Performer stores my database
into a GL display list during the first frame, so my color matrices are
also stored there. I is so? And what would be the best way around this
problem?

Of course I could render the scene twice, the second time with B/W
textures, but I am not very fond of that idea (twice the geometry, twice
the textures, more difficult to use as a "plug-and-play" routine,
difficulties in using transparent objects...)

I would greatly appreciate any help on this.

-- 
-----------------------------------------------------------------
Harri Kaimio                    |             harri.kaimio++at++yle.fi
Computer Graphics Specialist    |   http://cartes.hut.fi/~hkaimio
Finnish Broadcasting Company    |          Tel. +358-40-50 67 679
TV Production Operations        |           Fax. +358-0-1480 4769
=======================================================================
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:54:29 PDT

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