#### Archived

This topic is now archived and is closed to further replies.

# Texturing A Large Polygon

This topic is 5918 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi guys When I texture a 4 pt polygon I specify the texture coordinate of the corners, so the code is like...... glBegin (GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex3d ((pt1[0]), (pt1[1]), (pt1[2])); glTexCoord2f(0.0f, 1.0f); glVertex3d ((pt2[0]), (pt2[1]), (pt2[2])); glTexCoord2f(1.0f, 1.0f); glVertex3d ((pt3[0]), (pt3[1]), (pt3[2])); glTexCoord2f(1.0f, 0.0f); glVertex3d ((pt4[0]), (pt4[1]), (pt4[2])); glEnd (); My question is this if I have a 5 pt + polygon how do I specify the texture coordinates????? Cheers Garreth

##### Share on other sites
Same way as you would with a 4 point poly: Each tex coord should specify where on the texture the vertex is.

____________________________________________________________
www.elf-stone.com

##### Share on other sites
Simple formula:

U = desired_pixel_on_texture/texture_w
V = desired_pixel_on_texture/texture_h

So, say you have a 256x256 texture, and you want one of your vertices to be mapped to the point (128,32)

128/256 = 0.5
32/256 = 0.125

So your texture coordinates for that vertex are (0.5,0.125).

##### Share on other sites
Thanks Guys Its Worked!

1. 1
Rutin
26
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 10
• 9
• 9
• 9
• 46
• ### Forum Statistics

• Total Topics
631751
• Total Posts
3002077
×