Add texture to Teapot model
This commit is contained in:
parent
0b05138b33
commit
f14a04ddcb
5 changed files with 2353 additions and 1562 deletions
11
data/materials/teapot.mtl
Normal file
11
data/materials/teapot.mtl
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Blender MTL File: 'teapot.blend'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl None
|
||||
Ns 0
|
||||
Ka 0.000000 0.000000 0.000000
|
||||
Kd 0.8 0.8 0.8
|
||||
Ks 0.8 0.8 0.8
|
||||
d 1
|
||||
illum 2
|
||||
map_Kd teapot.png
|
File diff suppressed because it is too large
Load diff
BIN
data/textures/teapot.png
Normal file
BIN
data/textures/teapot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
4
main.cpp
4
main.cpp
|
@ -108,6 +108,7 @@ static Object *teapot1;
|
|||
static Object *bunny1;
|
||||
|
||||
static Texture *suzanne_tex;
|
||||
static Texture *teapot_tex;
|
||||
static Texture *bunny_tex;
|
||||
|
||||
int main()
|
||||
|
@ -152,6 +153,7 @@ int main()
|
|||
bunny1->position.x = 2.0;
|
||||
|
||||
suzanne_tex = new Texture("/data/textures/suzanne.png");
|
||||
teapot_tex = new Texture("/data/textures/teapot.png");
|
||||
bunny_tex = new Texture("/data/textures/bunny.png");
|
||||
|
||||
GLint u_texture = program.get_uniform_location("texture");
|
||||
|
@ -418,7 +420,7 @@ void iterate()
|
|||
suzanne_tex->use();
|
||||
suzanne1->draw(mvp);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
teapot_tex->use();
|
||||
teapot1->draw(mvp);
|
||||
|
||||
bunny_tex->use();
|
||||
|
|
BIN
work/teapot.blend
Normal file
BIN
work/teapot.blend
Normal file
Binary file not shown.
Reference in a new issue