0 original texture
1 nearest filter texture
2 Linear Filter texture
3 mipmapped texture
Int loadgltextures () // load the bitmap (call the above Code) and convert it to the texture {int status = false; // Status Indicator aux_rgbimagerec * textureimage [1]; // create a texture bucket memset (textureimage, 0, sizeof (void *) * 1); // set the pointer to null // load the bitmap, check for errors, or exit if (textureimage [0] = loadbmp ("E:/opensource/nehe/code/07_filterandlight/debug/data/crate.bmp") if the bitmap does not exist) {status = true; // set the status to trueglgentextures (3, & texture [0]); // create texture // create nearest filter texture glbindtexture (gl_texture_2d, texture [0]); gltexparameteri (gl_texture_2d, dimensions, gl_nearest); gltexparameteri (dimensions, dimensions, gl_nearest); glteximage2d (dimensions, 0, 3, textureimage [0]-> sizex, textureimage [0]-> sizey, 0, gl_rgb, cosine, textureimage [0]-> data); // create a linear filter texture glbindtexture (gl_texture_2d, texture [1]); gltexparameteri (gl_texture_2d, cosine, gl_linear ); gltexparameteri (callback, callback, gl_linear); glteximage2d (gl_texture_2d, 0, 3, textureimage [0]-> sizex, textureimage [0]-> sizey, 0, gl_rgb, callback, textureimage [0]-> data); // create the mipmapped texture glbindtexture (gradient, texture [2]); gltexparameteri (gl_texture_2d, gradient, gl_linear); gltexparameteri (gradient, cosine, cosine, parameters); glubuild2dmipmaps (gl_texture_2d, 3, textureimage [0]-> sizex, textureimage [0]-> sizey, gl_rgb, expires, textureimage [0]-> data );} if (textureimage [0]) // whether the texture exists {If (textureimage [0]-> data) // check whether the texture image exists {free (textureimage [0]-> data); // release the memory occupied by the texture image} Free (textureimage [0]); // release image structure} return status; // return status}
For more information, see:Http://www.owlei.com/DancingWind/Course/Tutorial_07.htm