PDA

View Full Version : Texturing polygons



GreatRedShark
03-26-2005, 05:00 PM
hey, this should be an easy one:
I'm having a bit of trouble texturing a pyramid. I am texturing it with a bitmap so that all the faces have a different part of the bitmap on them, but only the bottom face works (the only face that is a quadrilaterlal). I'm not sure if my problem is due to my texture coordinates, or something else, such as OpenGL not being able to texture quadrilaterlals.

Is it also just a freaky coincidence that all OpenGL tutorials I've EVER seen for texturing use just a cube? ...or am I just crazy/paranoid?

t3jem
03-26-2005, 05:57 PM
don't worry your not paranoid. You can texture map on triangles. Nehe has some great tutorials, tutorial 38 teaches triangle texture mapping. I havn't read it but the way I would texture map a triangle is just have two vertices for the top such as below.

glTexCoord2f(0,0);
glVertex2f(-1,0);
glTexCoord2f(0,1);
glVertex2f(0,1);
glTexCoord2f(1,1);
glVertex2f(0,1);
glTexCoord2f(1,0);
glVertex2f(1,0);

GreatRedShark
03-28-2005, 06:22 AM
actually, I discovered the problem was with the texture coordinates. It seems that blender's VRML exporter is broken, or does something strange to texture coordinates.
switched to OBJ format,and the coordinates in the file look much more believable than they did with the wrl file.