putting a texture on a nurbs surface

When I try putting a texture on a nurbs surface I get multiple copies of the texture repeated on the surface instead of just one smooth texture. Can anyone tell me how to correct this problem?

How do you “put” the texture on the nurb?

I thing nobody can help you if you post diffuse questions.

Originally posted by wedge:
[b]How do you “put” the texture on the nurb?

I thing nobody can help you if you post diffuse questions.[/b]

Thanks for the reply…didn’t realize the question wasn’t posed properly…

First I set up the texture in my initialization function with:

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

glGenTextures (1, texName);
glBindTexture(GL_TEXTURE_2D, texName[0]);
image1=auxDIBImageLoad(“Kadie.bmp”); // texture for a BMP file

glTexImage2D(GL_TEXTURE_2D, 0, 3, image1->sizeX, image1->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, image1->data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

Then in my display function I use:

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texName[0]); // use the tag for texture
gluBeginSurface(nurb);
gluNurbsSurface(nurb, 8, knots, 8, knots, 4 * 3, 3, &pts1[0][0][0], 4, 4, GL_MAP2_VERTEX_3);
gluNurbsSurface(nurb, 8, knots, 8, knots, 4 * 3, 3, &pts1[0][0][0], 4, 4, GL_MAP2_NORMAL);
gluNurbsSurface(nurb, 8, knots, 8, knots, 4 * 3, 3, &pts1[0][0][0], 4, 4, GL_MAP2_TEXTURE_COORD_2);
gluEndSurface(nurb);
glDisable(GL_TEXTURE_2D);

The result is that I get a 6 x 6 grid of my texture on the surface…i.e. 36 copies of my texture.
Does this make any more sence?

Texture is applied to a surface using texture coordinates, 0.0 to 1.0 across each axis. You are using glu utilities to create the geometry, and you have to use that API to control the mapping of s & t texture parameters. I’m not familiar with glu but I’d say it’s a safe bet that the call to gluNurbsSurface with the GL_MAP2_TEXTURE_COORD_2 is the culprit.

Even looking at this…
http://pyopengl.sourceforge.net/documentation/manual/gluNurbsSurface.3G.html

…I can’t figure it out (hey I’ve had a few beers here) but if you twiddle the numbers you’ll change the s & t mapping of the NURBS. I’d say sStride and tStride are the hot tickets but that’s a bit of a guess.