How to calculate texture coords?

I’m try to put texture on single
triangle.For example:
glBegin(GL_TRIANGLES);
glTextCoord3f(-0.5,-0.3,1.0); glVertex3f(-0.5,-0.3,1.0);glTexCoord3f((-0.1,-0.3,1.0));glVertex3f(-0.1,-0.3,1.0);
glTexCoord3f3f(-0.3,-0.1,1.0);glVertex3f(-0.3,-0.1,1.0);

The texture was load from BMP file.
When I try to draw this bmp ,it was
properly function.Then I try it put
this texture on the triangle.
All need properties was seted.
Help me.

use glTextCoord2f(x,y) (what you want to map is a surface, not a volume).

spaghetti

You don’t understand me.
I don’t know to calculate the coords.
The glTexCoord2f has two parameters
s and t.I couldn’t calculate s and t.
If x=-0.5f,y=-0.3f,z=1.0 how
value has s and t?

The texture coordinates are coord on the texture. (0,0) is the upper left, (1,1) is the lower right.

Try this:

glBegin(GL_TRIANGLES);
glTexCoord2f(0,0); glVertex3f(-0.5,-0.3,1.0);
glTexCoord2f(1,0); glVertex3f(-0.1,-0.3,1.0);
glTexCoord2f(0,1); glVertex3f(-0.3,-0.1,1.0);
glEnd();