Page 444 OpenGL Super Bible! Listing 12-3 Drawing (Adelphia web hosting)
Page 444 OpenGL Super Bible! Listing 12-3 Drawing a 1D textured rainbow glEnable(GL_TEXTURE_1D); glCallList(RainbowTexture); glBegin(GL_QUAD_STRIP); for (th = 0.0; th <= M_PI; th += (0.03125 * M_PI)) { /* * Bottom edge of rainbow */ x = cos(th) * 50.0; y= sin(th) * 50.0; z = -50.0; glTexCoord1f(0.0); glVertex3f(x, y, z); /* * Top edge of rainbow */ x = cos(th) * 55.0; y = sin(th) * 55.0; z = -50.0; glTexCoord1f(1.0); glVertex3f(x, y, z); }; glEnd(); To position the ROY-G-BIV texture on the rainbow, you call glTexCoord. For 1D textures, you call one of the glTexCoord1f, glTexCoord1d, glTexCoord1s, or glTexCoord1i functions. A value of 0.0 represents the leftmost pixel in the image, and 1.0 represents the rightmost pixel. Values outside this range are handled differently depending on the value of the GL_TEXTURE_WRAP_S parameter. If GL_TEXTURE_WRAP_S is set to GL_CLAMP (the default), then texture coordinates are restricted to a range of 0.0 to 1.0, inclusive. When a polygon strays from the texture image, it is drawn using the color(s) along the texture image s edges (see Figure 12-3) or the texture image border colors, if defined. Texture coordinates are traditionally referred to as S and T, or (s,t) instead of X and Y. Figure 12-3 GL_CLAMP textures
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.