3D Texture Coordinate Generation
← 3D Textures | ● | 3D Texture Slice →
If the model coordinates are bounded by [0,1], then the texture coordinates are identical to model coordinates:
glVertex3d(x,y,z);
If this is not the case, OpenGL supports a texture matrix stack to transform the texture coordinates just like the transformation of vertices with the model view matrix.
Example for model coordinates x,y,z∈[−0.5,0.5] and texture coordinates s,t,r∈[0,1]:
glLoadIdentity();
glTranslated(0.5,0.5,0.5);
glMatrixMode(GL_MODELVIEW);
Note: Transforming an object left, moves the object left. Transforming a texture coordinate left moves the texture coordinate left but it moves the texture visually right!
← 3D Textures | ● | 3D Texture Slice →