#VRML V1.0 ascii Separator { Material { diffuseColor 1.0 1.0 1.0 specularColor 0.8 0.8 0.8 } Texture2 { filename "number.gif" } TextureCoordinate2 { point [ 0 0, 1.0 0, 1.0 1.0, 0 1.0, 0.5 0.5 ] }Some reference points, four corners and a middle point, are defined on the texture map. The texture coordinate goes from 0.0 to 1.0 on the x axis and the y axis of the texture image.
MaterialBinding { value PER_VERTEX_INDEXED }Then the browser is told to expect a index value for each vertex.
Coordinate3 { point [ 0 5 0, -2.5 0 -2.5, 2.5 0 -2.5, 2.5 0 2.5, -2.5 0 2.5 ] } IndexedFaceSet { coordIndex [ 0, 4, 3, -1, 0, 3, 2, -1, 0, 2, 1, -1, 0, 1, 4, -1, 1, 3, 4, -1, 1, 2, 3, -1 ] textureCoordIndex [ 4, 2, 3, -1, 4, 3, 0, -1, 4, 0, 1, -1, 4, 1, 2, -1, 0, 2, 3, -1, 0, 1, 2, -1 ] } }The texture coordinate, which associate to each vertex, are given in the materialIndex node. This is similar to assign a color to each vertex. As an exercise, the reader can try to modify this file to eliminate the need of textureCoordIndex.