PDA

View Full Version : The texture matrix and multitexturing



Ehsan Kamrani
05-28-2005, 04:54 AM
In my program, i have used from multitexturing technique
DrawQuad()
{
glNormal3f( 0,0,1);
glBegin( GL_QUADS );
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0,0);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0,0);
glVertex3f(-1,-1,1);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1,0);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1,0);
glVertex3f(1,-1,1);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1,1);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1,1);
glVertex3f(1,1,1);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0,1);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0,1);
glVertex3f(-1,1,1);
glEnd();
}
But when i want to translate ( or rotate )the textures, only one of the textures is translated( rotated ).I have used from the following code to transform the textures:

glMatrixMode( GL_TEXTURE );
glLoadIdentity();
glTranslatef( variable, 0.0f, 0.0f );

glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0f, 0.0f, -6.0f );
DrawQuad();
glPopMatrix();

So what's the problem?
Note:Multitexturing works correctly.

-Ehsan-

jide
05-28-2005, 05:16 AM
use glActiveTextureARB (texture_arb_id) with GL_TEXTURE0_ARB, GL_TEXTURE1_ARB and so on to select which active texture you'll use after the call.

Because they are two different textures unit, they own two texture matrices, so you'll have to do the work for both of them.

Ehsan Kamrani
05-28-2005, 09:53 AM
OK.Now i understand. :rolleyes: many special thanks to you.
-Ehsan-