Upload presentasi
Presentasi sedang didownload. Silahkan tunggu
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 mengunakan library texture TGA
Format gambar : TGA(Truevision Graphics Adapter) Beberapa ketentuan: Kedalaman warna 8, 24, atau 32 bit Dimensi gambar (panjang atau lebar) harus pangkat 2, misal 8, 16, 32, 128, 512 pixel Yang bisa diberi texture adalah objek primitif (GL_POLYGON dkk)
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); // kiri bawah glVertex3f(-3.0f,-3.0f,0.0f); glTexCoord2f(1.0f,0.0f); // kanan bawah glVertex3f(3.0f,-3.0f,0.0f); glTexCoord2f(1.0f,1.0f); // kanan atas glVertex3f(3.0f,3.0f,0.0f); glTexCoord2f(0.0f,1.0f); // kanan bawah glVertex3f(-3.0f,3.0f,0.0f); glEnd();
Presentasi serupa
© 2024 SlidePlayer.info Inc.
All rights reserved.