VRML Script Tutorial
VRML Interactive Tutorial
Hierarchical Node Structures
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
The ordering of the points is relevant. The order should be counter clockwise starting from the origin to keep the orientation of the texture. If the start point is different then the texture is rotated by multiples of 90 degrees. Presenting the point in a clockwise direction will mirror the texture. Try it yourself of the right frame.
It is now described how TextureCoordinate points define texturing for a single face. Afterwards particular features of textures for IndexedFaceSet and ElevationGrid are presented.
You can select only a part of the texture, for instance if the points given are (0 0) (0.5 0) (0.5 0.5) (0 0.5). Only a quarter of the texture will be used
The next figure shows the result obtained.
You can also use this node to have the texture repeated, for instance consider the following points: (0 0), (2 0),(2 2), (0 2). In this case the texture is repeated twice in each dimension.
More complex settings can be used which restrict the texture in one dimension but repeat it in the other dimension. For example consider the points (0 0) (0.5 0) (0.5 2) (0 2). The left image shows the result of using this texture coordinates in a square face, the right image shows the area selected in terms os texture coordinates.
In all the examples above the area selected was either square or rectangular. There is nothing preventing you from choosing non-rectangular areas, however the number of points must match the number of coordinates used to build the face, i.e. you can't match a triangular selection into a square face.
The next two sections describe particular features of IndexedFaceSet and ElevationGrid,
The number of points in the TextureCoordinate must be at least equal to the number of points of the face with highest number of points.
If the field texCoordIndex is not NULL then the values of this field specify the indexes of the TextureCoordinate points which are used to define the selection for each face.
If the field texCoordIndex is NULL then the field coordIndex is used to specify the indexes.
A texture coordinate is defined for each point in the grid. The first point in the grid corresponds to the first point in the TextureCoordinate node, the last point in the grid corresponds to the last point in the TextureCoordinate node. There must be as many points in the ElevationGrid as there are in the TextureCoordinate node.