I have 2 textures which one of them, I need to alter its matrix (scaling.). What I am currently doing is:
bindthefirsttexture();
glPushMatrix();
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(2,2,0);
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
bindthesecondtexture();
do some other stuff here.
However, that matrix transformation is applied on the second texture too! What am i doing wrong here?
Thanks
I think you need to reset your texture matrix before drawing the second one.
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
yakuza
December 8, 2002, 9:30am
3
You need to push the matrix stack after loading the texture matrix, otherwise you’re pushing the modelview stack.
Edit: And pop the stack before switching back to the modelview.
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glLoadIdentity();
do stuff
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
do the other stuff
Hope that helps
[This message has been edited by yakuza (edited 12-08-2002).]
kaysoft
December 8, 2002, 12:25pm
4
Thanks, makes sense.
I will try that later and tell you.
That didnt work, it didnt scale the matrix. Any other ideas?
yakuza
December 9, 2002, 7:48am
6
Make sure you did your drawing after scaling the texture matrix, but before popping the texture matrix stack, otherwise you lose the changes you made.
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glLoadIdentity();
glScalef();
Draw_stuff_that_uses_scaled_texture_matrix();
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
do the other stuff