Texture Transform

Dear Forum

Im able to apply a Texture to some surface,so basically i know the opengl command
for do this. But I not understand why in the Vertex Processing, we need the Texture Transform
(via Texture Matrix)

Thanks

Roberto

You don’t need that and nobody forces you to use it, but you can use a 3x3 texture matrix to conviniently rotate, translate & scale the texture coordinates on the surface.

Thanks for reply…but this is not clear again.

Image we assign a square texture to a square geometri; we assign texture coordinate .
Thne vertex pass trough MV matrix and so on…My texture pass trough the same matrix ?
And what is I have the same texture for more geometry??

Opengl is not doing the texture mapping automatically after we assign texture coordinate ?

So, why exist the texture matrix is not clear…

Thanks

Roberto

The texture matrix exists because not everyone is assigning “a square texture to a square geometri”. The texture matrix can be used to shift texture coordinates, so that the texture appears to slide across a surface. It can be used to rotate a texture independent of the geometry that the texture is attached to, so that the texture will rotate on a surface. And so forth.

The texture matrix exists because it’s useful (though not frequently so) to be able to transform texture coordinates before using those coordinates to access the texture.

just a pratical precisation:

I apply my texture to the frontal face of my cube…setting texture coordinate.

Than i rotate the cude of 45 degree around y axis…so,now we se my face but not square anymore…
I have to rotate also the texture coordinate ?

Thanks

I have to rotate also the texture coordinate ?

No. You’re changing the position of the object (which is what the positions control), not the mapping between the object and the texture (which is what the texture coordinates control).

You’re thinking about this way too hard.

Roberto, normally the texture matrix is identity matrix, so it’s existence has kinda no effect when fixed functionality is used. It is so in case of basic model’ skin texturing. But there was a time before shaders, when people were texturing with shadowmaps - the texture matrix was configured in a very special way to do a shadow trick. So basically, you should just leave it aside. In modern OpenGL all those built-in variables and texture matrices are gone anyway, so don’t bother. :slight_smile:

Thanks for reply a lot.
Post end.

Roberto

The texture matrix is 4x4.

Like vertices, texture coordinates nominally have 4-components; if fewer components are specified, the second and third default to zero while the fourth defaults to one.

The third component is used for 3D (voxel) textures, cube maps, and with the GL_COMPARE_REF_TO_TEXTURE comparison mode (typically used for shadow maps). The fourth component can be used with any texture type if you require a projective mapping.