PDA

View Full Version : texture animation



Visualc++
09-01-2002, 03:13 PM
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?

zed
09-01-2002, 07:16 PM
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'

Korval
09-01-2002, 08:21 PM
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().

restless
09-01-2002, 10:32 PM
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.

Visualc++
09-02-2002, 06:34 PM
not work (snif) any other idea?