PDA

View Full Version : Texture Map coordinates



mikeleblanc
12-01-2008, 12:03 PM
Hi, below is my code and texture not showing. please help. thanks

yConst = -300;
for (x=-300; x < 300; x+=5)
for (z=600; z > -600; z-=5)
{
glTexCoord3f(0.0,1.0); glVertex3f( x, yConst, z); //Top Left glTexCoord3f(0.0,0.0); glVertex3f(x+5, yConst, z);// Bottom Left glTexCoord3f(1.0,0.0); glVertex3f(x+5, yConst, z-5);// Bottom Right
glTexCoord3f(1.0,1.0); glVertex3f( x, yConst, z-5);// Top Right
}

dletozeun
12-01-2008, 03:33 PM
The above code is not the whole necessary code to display a texture and should not even compile since you call glTexCoord3f with 2 parameters and it takes 3 ones.

Moreover, glBegin/glEnd calls lack or are not included in the above piece of code IMO.

For more information about texture mapping, read this if it is not already done:
http://www.opengl.org/wiki/index.php/Texture_Mapping