Use textures in OpenGL

Source: Internet
Author: User
Aux_rgbimagerec * textureimage [3];
Textureimage [0] = auxdibimageloada ("floor.bmp"); // ---------- return the header pointer
Textureimage [1] = auxdibimageloada ("wall.bmp ");
Textureimage [2] = auxdibimageloada ("wall3.bmp ");
Glgentextures (3, & texture [0]); // create a texture name
For (INT I = 0; I <3; I ++)
{
Glbindtexture (gl_texture_2d, texture [I]); // use a typical texture generated from the bitmap data
// Generate texture
Glteximage2d (gl_texture_2d, 0, 3, textureimage [I]-> sizex, textureimage [I]-> sizey, 0, gl_rgb, gl_unsigned_byte, textureimage [I]-> data );
Gltexparameteri (gl_texture_2d, gl_texture_min_filter, gl_linear); // linear filter, mainly used to zoom in or out the texture Algorithm Including linear, nearest neighbor, bilinear interpolation, etc.
Gltexparameteri (gl_texture_2d, gl_texture_mag_filter, gl_linear );
}

Glable (gl_texture_2d );

Create three textures. To use these textures, call
Glbindtexture (gl_texture_2d, texture [I]);

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.