Texturing a figure

Hi guys.
Sorry for my english.I don’t speak it as well as i wish.

My question is about texturing.I’ve write a program to show a few figures in 3D like spheres, torus,cube,etc, all made by triangles.
When i try to texture them, the image is repeated in every triangle, so i can’t see it well. I have tried to texture the whole figure with one time image but i don’t know how.I have read the Red Book but i can’t find any solution.Is it posible?Any idea?

I use
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, nTextureWidth, nTextureHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, pBitmapData);

to create the texture,and

glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR);

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_2D);

to texture the figure.

Thanks in advance.

How are you drawing the triangles?

You would need to specifiy the portion of the image that should be applied to each triange, or as you see the entire image is applied to the triangle.

Nehe’s tutorials would help here.

When the figure is created,i calculate the vertices and the faces that share them,but the number is not a constant,it may change according to a dinamic detail variable, diferent in each figure.
So i could have from 1 to 5000 triangles.
I don’t calculate texture coords,i suppose
the glEnable(GL_TEXTURE_GEN_S) and glEnable(GL_TEXTURE_GEN_T) will generate them.I’m wrong ?

I have also read the Nehe tuts,but i can’t find a solution or i don’t understand it.

Thanks.