PDA

View Full Version : Texturing Doubts



iris_raj
09-19-2003, 03:34 AM
I was able to assign texture coordinates to four vertices assign
I want to texture a polygon. How to assign coordinates to the other two coordinates. The following is the code I have written.


glBindTexture(GL_TEXTURE_2D,texName[2]);
glBegin(GL_POLYGON);
glColor3f(0.0,0.0,0.95);
glTexCoord2f(0.0,0.0);
glVertex3f(0.0,0.0,0.0);
glTexCoord2f(0.0,1.0);
glVertex3f(1.0,0.0,0.0);
glTexCoord2f(1.0,1.0);
glVertex3f(1.0,1.0,0.0);
//glColor3f(0.0,1.0,0.0);
glTexCoord2f(1.0,0.0);
glVertex3f(0.5,1.5,0.0);
glVertex3f(0.0,1.0,0.0);
glEnd();

Regards

poo
09-19-2003, 10:15 AM
Just because a texture in loaded as a square, it doesn't mean it has to be applied as a square. If your polygon has six vertices, define six corresponding points within your texture. You don't have to use the entire texture.