Vizard 7 » Reference » Appearance & Texturing » Texture wrapping
7.6

Texture Wrapping

To control how textures are wrapped on models, models define texture coordinates for their geometry that tells Vizard which part of the texture should go on which part of the geometry.  All 2D textures have a coordinate system with two axes: the S axis which runs along the width of the image, and the T axis which runs along the height.  The texture's coordinates always range from 0 to 1.0 with (0, 0) at the bottom left.  This two value, 0 to 1.0 system gives the geometry an easy way to reference the area of the image they want applied to their surface.  Geometry defines the part of the texture it wants to use with its own S and T texture coordinates.  In 3D modeling programs, the two texture axes are known as S and T.  Modeling software calls the process of wrapping geometry in textures S-T mapping.

 

Another OpenGL feature of textures is setting the wrap mode. The wrap mode defines how a texture behaves when it is given texture coordinates outside the range of 0 to 1. Here is a list of all the possible wrap modes:

Texture wrap mode

Description

viz.CLAMP

Texture pixels outside the [0,1] range will be clamped to the border of the texture.

viz.CLAMP_TO_EDGE

Similar to CLAMP except that the border pixels are not interpolated with the border color.

viz.CLAMP_TO_BORDER

Texture pixels outside the [0,1] range will use the border color.

viz.REPEAT

This causes the texture to be tiled. So a texture coordinate of 2.6 will be equal to 0.6.

viz.MIRROR

This causes the texture to be mirrored. So a texture coordinate of 1.2 will be equal to 0.8.

When setting the wrap mode of the texture you must set it for each texture axis individually. The horizontal axis is referred to as the S coordinate and the vertical axis is referred to as the T coordinate. So to set the wrap mode of both axis of a texture to REPEAT you would do the following:

texture.wrap(viz.WRAP_S,viz.REPEAT)
texture.wrap(viz.WRAP_T,viz.REPEAT)

See also

In this section:

Appearance & texturing basics

Multi-texturing

Environment mapping

Texture appearance and filtering

Texture types

Texture matrix

Visibility

Draw order & Z offsetting

Projecting textures

Appearance & texturing command table

Other sections:

Tutorial: Applying Textures