Re: [info-performer] Texture Animation

Date view Thread view Subject view Author view

From: lawrence bertoldi (lberto++at++adelphia.net)
Date: 10/08/2003 06:08:34


Another way you might consider is to change the offset in the with a
pfTexGen for each plane!
for example:

    //*** set up the texgen
    pfTexGen *tgen0 = new pfTexGen;
    tgen0->setMode(PF_S, PFTG_OBJECT_LINEAR);
    tgen0->setMode(PF_T, PFTG_OBJECT_LINEAR);
    tgen0->setMode(PF_R, PFTG_OFF);
    tgen0->setMode(PF_Q, PFTG_OBJECT_LINEAR);
    tgen0->setPlane(PF_S, 0.001f, 0.0f, 0.0f, 0.051f);
    tgen0->setPlane(PF_T, 0.0f, 0.001f, 0.0f, 0.051f);
    tgen0->setPlane(PF_Q, 0.0f, 0.0f, 0.0f, 1.0f);

    //*** add it to the geostate
    gstate->setMultiAttr(PFSTATE_TEXGEN,0, tgen0);

     //***in your update function get the texgen and change the offset!
    pfTexGen *texGen = (pfTexGen *)gstate->getMultiAttr(PFSTATE_TEXGEN, 0);

    //*** to get a number between 0 and 1
    pfSinCos(time,movS,movT);
                                    //*** scale in X scale in Y
  scale height offset texture
    tgen0->setPlane(PF_S, 0.001f, 0.0f, 0.0f,
                   abs(movS));
    tgen0->setPlane(PF_T, 0.0f, 0.001f, 0.0f,
                   abs(movT));

One more way is to manipulate the OpenGL texture matrix in a Draw
callback.

DrawCB()
{
   glMatrixMode(GL_TEXTURE);
   glPushMatrix();
   glTranslatef (movX,movY,0);
   glMatrixMode(GL_MODELVIEW);
   
   // do other stuff and then draw
    gset->draw();
   // return the state as you found it
   glMatrixMode(GL_TEXTURE);
   glPopMatrix();
   glMatrixMode(GL_MODELVIEW);
}

See Ya
Lawrence Bertoldi
Simagery Inc.

Govers, Francis wrote:

>Hi:
>
>I'm looking for a simple way to animate a single texture. I need to move
>the UV coordinates to make the texture move along the object (its a
>visualization of a comm link). my geometry is a simple rectangle with a UV
>map tiled 10 times along its length. I'd just like to grab the UV
>coordinates and increment them each frame by some small amount.
>
>Thanks.
>
>Francis X. Govers III
>MITL M&S Team
>Northrop Grumman
>310-930-3463
>fgovers++at++ngc.com
>
>-----------------------------------------------------------------------
> List Archives, Info, FAQ: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>-----------------------------------------------------------------------
>
>
>
>


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Oct 08 2003 - 06:27:29 PDT