PDA

View Full Version : texture scaling



Bruno
11-30-2004, 01:27 AM
Hi,

Is a texture scaling ignored in a vertex program ?
Like doing this ?

glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(8,8,8);
glMatrixMode(GL_MODELVIEW);

I get it the usual way, in the vertex program

gl_TexCoord[0] = gl_MultiTexCoord0;

But somehow the scaling is ignored.

def
11-30-2004, 02:01 AM
You will need to multiply the texture coordinates with the gl_TextureMatrix[]. This should behave similar to model transformations and the gl_ModelViewMatrix.
I hope this helps, I never used the texture matrix functionability myself...

jra101
11-30-2004, 05:50 AM
When using a vertex shader or vertex program you need to apply the texture matrix yourself. In your case you would just do this:


gl_TexCoord[0] = gl_MultiTexCoord0 * gl_TextureMatrix[0];

Relic
11-30-2004, 06:49 AM
Matrices in OpenGL are left-multiplied, here that'd be
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;