Texture Filter)

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.