PDA

View Full Version : The texture matrix



esuvs
01-26-2002, 09:51 AM
Hi,
Does the texture matrix contain all the information that is needed in order to map a texture onto a polygon?
I have seen in some 3D engines the texture information for a polygon is stored by the name of the texture and a scale and rotation value. Presumably these are then used to automatically generate the texture co-ordinates.
But would it be possible to instead store the texture name and a copy of the matrix? Then just load the matrix and draw the texture? Or do you need other information such as the normal to the polygon?
Thanks in advance,

David

haust
01-26-2002, 10:47 AM
esuvs, the texture matrix acts like the modelview and projection matrices : it just modify the specified values (texture coords) with the operations you perform on this matrix (translate, rotate, scale). These operations can be used for some quake 3 shader-like effects. So no you can't just load a matrix to the tex matrix, you still need to specify the tex coord themselves. And normals are for lights, AFAIK textures don't care about normals....

Bob
01-26-2002, 01:30 PM
Textures (well, the texture units) do care about the normals sometimes. When autogenerating texture coordinates, like GL_SPHERE_MAP and GL_REFLECTION_MAP_NV, the normal is used.

esuvs
01-27-2002, 04:46 AM
I assumed that when you specified a polygon with a texture and texture co-ordinates, OpenGL used the texture co-ordinates to build the texture matrix. Hence I thought you could then save this matrix and use it next time.
If this is not the case, then what else does OpenGL require to draw a textured polygon, apart from the polygon, the texture, and the texture matrix?

Bob
01-27-2002, 12:35 PM
What you need to draw a textured polygon is: a polygon, a set of texture coordinates for that polygon, and a texture. The texture matrix is always there, and you don't have to worry about it (that is, don't touch it) until you get into advanced texture mapping.