This example shows how to texture map an object with more precise control.


#VRML V2.0 utf8

Group {
   children [
      Shape {
         appearance
         Appearance {
            material
            Material {
               diffuseColor     1 1 1
               specularColor    0.8 0.8 0.8
            }
            texture
            ImageTexture {
               url      "http://www.npac.syr.edu/users/gcf/meryem/Tutorial/VRML/Pyramid/number.gif"
            }
         }
         geometry
         IndexedFaceSet {
            coord
            Coordinate {
               point    [ 0 5 0,
                          -2.5 0 -2.5,
                          2.5 0 -2.5,
                          2.5 0 2.5,
                          -2.5 0 2.5 ]
            }
            texCoord
            TextureCoordinate {
               point    [ 0 0,
                          1 0,
                          1 1,
                          0 1,
                          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. 

            solid       FALSE
            creaseAngle 0.5
            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 ]
            texCoordIndex       [ 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
texCoordIndex 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.

         }
      }
     ]
}