MedicalVisualization

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:

glTexCoord3f(x,y,z);
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\in[-0.5,0.5]$ and texture coordinates $s,t,r\in[0,1]$:

glMatrixMode(GL_TEXTURE);
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

Options: