TGA and RGB image loading

This commit is contained in:
trotFunky 2019-09-25 00:36:57 +02:00
parent ff59df8e28
commit e83cdba55b
7 changed files with 169 additions and 3 deletions

View file

@ -60,17 +60,39 @@ void display_rotating_pyramid(float x, float y, float z, float c, float h, float
glPopMatrix();
}
void display_tree(float x, float y, float z, float h, float w)
void display_tree(float x, float y, float z, float h, float w, const Texture& tree_texture)
{
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glBindTexture(GL_TEXTURE_2D,tree_texture.opengl_id[0]);
glColor4f(1.0f, 1.0f, 1.0f,1.00);
glBegin(GL_QUADS);
// First rectangle
glTexCoord2f(1,0);
glVertex3f(x+w/2,y,z);
glTexCoord2f(0,0);
glVertex3f(x-w/2,y,z);
glTexCoord2f(0,1);
glVertex3f(x-w/2,y+h,z);
glTexCoord2f(1,1);
glVertex3f(x+w/2,y+h,z);
// Second rectangle
glTexCoord2f(1,0);
glVertex3f(x,y,z+w/2);
glTexCoord2f(0,0);
glVertex3f(x,y,z-w/2);
glTexCoord2f(0,1);
glVertex3f(x,y+h,z-w/2);
glTexCoord2f(1,1);
glVertex3f(x,y+h,z+w/2);
glEnd();
}