1 / 8

Texture Mapping

Texture Mapping. Texture Mapping. Menggambar “tekstur” pada permukaan suatu poligon Tekstur berupa gambar yang akan ditempelkan pada permukaan poligon Ibarat menempelkan gambar di sekeliling kardus. Gambar tekstur. Ilustrasi. +. =. Objek. Objek dengan tekstur. TGA Texture.

Télécharger la présentation

Texture Mapping

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Texture Mapping

  2. Texture Mapping • Menggambar “tekstur” pada permukaan suatu poligon • Tekstur berupa gambar yang akan ditempelkan pada permukaan poligon • Ibarat menempelkan gambar di sekeliling kardus

  3. Gambar tekstur Ilustrasi + = Objek Objek dengan tekstur

  4. TGA Texture • Texture mapping mengunakanlibrary texture TGA • Format gambar : TGA(TruevisionGraphics Adapter) • Beberapaketentuan: • Kedalamanwarna 8, 24, atau 32 bit • Dimensigambar (panjangataulebar) haruspangkat 2, misal 8, 16, 32, 128, 512 pixel • Yang bisadiberi texture adalahobjekprimitif (GL_POLYGONdkk)

  5. Specify Texture • Simpan image ke array imageData • glTexImage2D (GL_TEXTURE_2D, 0, texFormat, imageWidth, imageHeight, 0, texFormat, GL_UNSIGNED_BYTE, imageData);

  6. Parameter Wrapping • glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); • glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); Filtering • glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); • glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

  7. Color Blend • glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

  8. Bind Texture and Draw • glEnable(GL_TEXTURE_2D); // Enable texture mapping • glBindTexture(GL_TEXTURE_2D,1); // Bind texture indeks 1 • glBegin(GL_QUADS); • glTexCoord2f(0.0f,0.0f); // kiribawah • glVertex3f(-3.0f,-3.0f,0.0f); • glTexCoord2f(1.0f,0.0f); // kananbawah • glVertex3f(3.0f,-3.0f,0.0f); • glTexCoord2f(1.0f,1.0f); // kananatas • glVertex3f(3.0f,3.0f,0.0f); • glTexCoord2f(0.0f,1.0f); // kananbawah • glVertex3f(-3.0f,3.0f,0.0f); • glEnd();

More Related