void Draw() { glBindTexture(GL_TEXTURE_2D, texture); glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, material.diffuse); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, material.specular); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, material.emissive); glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, material.shininess); glMatrixMode(GL_MODELVIEW); glPushMatrix(); mesh_transform.applyTransformation(); glBegin(GL_TRIANGLES); for (int i = 0; i < mesh.num_of_indices; i++) { Vertex& curVertex = mesh.vertices[mesh.indices[i]]; glTexCoord2f(curVertex.texture_coord.U, curVertex.texture_coord.V); glNormal3f(curVertex.normal.X, curVertex.normal.Y, curVertex.normal.Z); glVertex3f(curVertex.position.X, curVertex.position.Y, curVertex.position.Z); } glEnd(); glPopMatrix(); }
void BeginDraw() { glMatrixMode(GL_MODELVIEW); glPushMatrix(); transform.applyTransformation(); }