SlideServe
Menu
Préférences
© SlideServe · v2026

Texture Mapping

meriel avatar
14 diapositives · 429 Views · Sep 21, 2014

Texture Mapping. Introduction. What is Texture Mapping? Types of Texture Mapping 1D, 2D and 3D SDL and OpenGL. Getting Your Feet Wet. Five Steps in Getting Texture Mapping to Work 1. Load the Bitmap 2. Generate the Texture Handle 3. Bind and Configure 4. Build Texture in OpenGL

Texture Mapping - slide 1
01 / 14Texture Mapping
1 / 17

Télécharger la présentation

Texture Mapping
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Texture Mapping

  2. Introduction • What is Texture Mapping? • Types of Texture Mapping • 1D, 2D and 3D • SDL and OpenGL

  3. Getting Your Feet Wet • Five Steps in Getting Texture Mapping to Work • 1. Load the Bitmap • 2. Generate the Texture Handle • 3. Bind and Configure • 4. Build Texture in OpenGL • 5. Bind and Use

  4. A Little More Detail • 1. Load Bitmap • 2. Generate a Texture Handle • glGenTextures(1, &temptex); • 3. Bind and Configure • glBindTexture (GL_TEXTURE_2D, nNewTextureID); • glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); • glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); • glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); • glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); • 4. Build the Texture in OpenGL • gluBuild2DMipmaps (GL_TEXTURE_2D, nBPP, nWidth, nHeight, • (nBPP == 3 ? GL_RGB : GL_RGBA),GL_UNSIGNED_BYTE, • pData);

  5. In Depth Discussion • The Bitmap File Format • File Header • Size and Type of File • Info Header • Image dimensions • Bits per Pixel (BPP) • Image Data(unsigned char) • What can be used as a Texture?

  6. In Depth Discussion • Texture Handle Generation • glGenTextures(1, &temptex); • GL_TEXTURE_1D and GL_TEXTURE_3D • Texture Binding • glBindTexture (GL_TEXTURE_2D, TextureID); • Environment Settings • glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); • GL_DECAL and GL_BLEND

  7. In Depth Discussion • Texture Wrapping Parameters • glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); • glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); • Also GL_CLAMP

  8. In Depth Discussion • Texture Resizing Filters • glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) • GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR, GL_LINEAR_MIPMAP_NEAREST, and GL_LINEAR_MIPMAP_LINEAR • glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) • GL_LINEAR

  9. In Depth Discussion • What are Mipmaps? • Building the Texture • gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, width, height, GL_RGB, GL_UNSIGNED_BYTE, data) • Using the Texture • glTexCoord2f(0.0, 1.0); glVertex3i(-1, 1, 1)

  10. Texture and Lighting • Four Steps for Lighting • Calculate Normals • Position Light • Choose Shading Model • Set Material • Setting Materials • glMaterialfv(GL_FRONT, GL_AMBIENT, matAmbient) • glMaterialfv(GL_FRONT, GL_DIFFUSE, matDiffuse)

  11. Texture Transparency • The Blending Function • glEnable(GL_BLEND); • glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); • glColor4f(1.0f, 1.0f, 1.0f, 0.5) • Depth Testing Issues

  12. Playing with Texture Coordinates • Easy as Pie • Take your original Texture coordinates and move them around • Use Texture Coordinates to only show part of the image • Textured Fonts

  13. Multi-Pass Multi-Texturing • What is Multi-Texturing • Why not Single Pass Multi-Texturing • How to do Multi-Pass Multi-Texturing • 1. Draw your object with base texture • 2. Draw your object again with blended texture • 3. Repeat step 2 till satisfied

  14. Advanced Topics • Other uses of Texture Mapping • Imposters • Lightmapping • Shadowmapping • Environment Mapping • Projective Texturing • Procedural Texture Generation