Web design - Page 440 OpenGL Super Bible! The width parameter

Page 440 OpenGL Super Bible! The width parameter specifies the width of the main texture image (without the border pixels) and must be a power of 2. The format argument indicates the type of color values to expect GL_COLOR_INDEX, GL_LUMINANCE, GL_RGB, or GL_RGBA. You ll find an example of defining a 1D texture in Listing 12-1 and in the example code CH12TEX1D.C on the source code CD-ROM. Listing 12-1 Defining a 1D texture image void LoadAllTextures(void) { static unsigned char roygbiv_image[8][3] = { { 0×3f, 0×00, 0×3f }, /* Dark Violet (for 8 colors ) */ { 0×7f, 0×00, 0×7f }, /* Violet */ { 0xbf, 0×00, 0xbf }, /* Indigo */ { 0×00, 0×00, 0xff }, /* Blue */ { 0×00, 0xff, 0×00 }, /* Green */ { 0xff, 0xff, 0×00 }, /* Yellow */ { 0xff, 0×7f, 0×00 }, /* Orange */ { 0xff, 0×00, 0×00 } /* Red */ }; glNewList(RainbowTexture = glGenLists(1), GL_COMPILE); glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage1D(GL_TEXTURE_1D, 0, 3, 8, 0, GL_RGB, GL_UNSIGNED_BYTE, roygbiv_image); glEndList(); } The example code creates a display list containing the texture image and the desired magnification and minification filter, GL_LINEAR. The minification filter is used when the polygon to be drawn is smaller than the texture image, in this case 8 pixels. The magnification filter is used when the polygon is larger than the texture image. By designating the GL_LINEAR filter, you tell OpenGL to linearly interpolate color values in the texture image before drawing anything on the screen. The other filters you can use for GL_TEXTURE_MIN_FILTER are listed in Table 12-1.
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

Leave a Reply