Graphics Programs Reference
limited to some devices. So, for all the applications in the source
code in which we have demonstrated the use of textures, we have
only used textures with power-of-two dimensions.
First, let's look at defining texture coordinates. Consider an example in which we
top-right corners of the texture (image) are specified by (s, t) coordinates as (0,
0) and (1, 1) , respectively. If the specified (s, t) coordinate is outside the
range [0, 1] , you can specify texture wrap mode, independently for both the s-co-
ordinate and t-coordinate. Using wrap mode GL_REPEAT , texture outside this range
is simply repeated.
pose we use glDrawElements to render it. The short array planeISA in List-
ing 5-4 consists of one of the ways to specify the indices, to access vertices from
planeVFA vertex array (to render this square). To wrap texture around this square,
when vertices are fetched using index array planeISA , texture coordinates must
also be fetched. To make sure that texture coordinates are fetched in the same order
as that of the vertices, you need to understand the sequence shown in Table 5-1 .