Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: texture animation

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2002
    Posts
    23

    texture animation

    i need move the texture in the scene, i try that:

    glLoadIdentity();
    glMatrixMode(GL_TEXTURE);
    glTranslatef(textras,textras,textras);
    glMatrixMode(GL_MODELVIEW);
    glFlush();


    glLoadIdentity();
    glColor4d(0,0,0,0.5);
    glBlendFuncGL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
    glRotatef(lookupdown,1.0f,0,0);
    glRotatef(sceneroty,0,1.0f,0);
    glTranslatef(xtrans-50, ytrans-1, ztrans-550);
    glRotatef(-90.0f,1.0f,0.0f,0.0f);
    glRotatef(90.0f,0.0f,0.0f,1.0f);
    glScalef(2.0f,2.0f,2.0f);
    glCallList(AguaG);
    glFlush();

    the problem is this code move all the textures in the scene, not only the textures in the list, i try with glpop and glpushmatriz but not work.... what is wrong?

  2. #2
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Jul 2000
    Location
    S41.16.25 E173.16.21
    Posts
    2,609

    Re: texture animation

    glMatrixMode(GL_TEXTURE);
    glTranslatef(textras,textras,textras);
    glLoadIdentity(); <- u need to set it back to identity when youre finished, opengl is a statemachine 'ie once something is on it will stay on until turned off'

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: texture animation

    To clarify a bit what Zed is saying, you need to, after you draw the geometry that uses the texture matrix, set the texture matrix back to the identity with glLoadIdentity().

  4. #4
    Junior Member Newbie
    Join Date
    Aug 2002
    Posts
    5

    Re: texture animation

    It has to be like this...

    glLoadIdentity();
    glMatrixMode(GL_TEXTURE);
    glTranslatef(textras,textras,textras);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glColor4d(0,0,0,0.5);
    glBlendFuncGL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

    glRotatef(lookupdown,1.0f,0,0);
    glRotatef(sceneroty,0,1.0f,0);
    glTranslatef(xtrans-50, ytrans-1, ztrans-550);
    glRotatef(-90.0f,1.0f,0.0f,0.0f);
    glRotatef(90.0f,0.0f,0.0f,1.0f);
    glScalef(2.0f,2.0f,2.0f);
    glCallList(AguaG);

    glMatrixMode(GL_TEXTURE);
    glLoadIdentity();
    glMatrixMode(GL_MODELVIEW);

    //... other code

    glFlush();

    And plz notice only one glFlush per frame - in the end.
    ---------------
    Restless

  5. #5
    Junior Member Newbie
    Join Date
    Aug 2002
    Posts
    23

    Re: texture animation

    not work (snif) any other idea?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •