PDA

View Full Version : NURBS texturing problem



jmd
02-27-2002, 11:48 AM
Hello,

I am trying to texture NURBS.
I have found examples with 4 control points but I am trying to do it with any number of control points.

I am doing something like :

GLfloat ctlpoints[9][9][3] = {...};
GLfloat texpoints[2][2][2] = {{{0.0f, 0.0f}, {0.0f, 1.0f}},
{{1.0f, 0.0f}, {1.0f, 1.0f}}};
GLfloat knots13[13] = {0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 6.0, 6.0, 6.0};
GLfloat knots4[4] = {0.0f, 0.0f, 1.0f, 1.0f};

gluBeginSurface(theNurb);
gluNurbsSurface(theNurb,
13, knots13, 13, knots13,
3, 9*3, &ctlpoints[0][0][0],
4, 4, GL_MAP2_VERTEX_3);
gluNurbsSurface(theNurb,
4, knots4, 4, knots4,
2*2, 2, &texpoints[0][0][0],
2, 2, GL_MAP2_TEXTURE_COORD_2);
gluEndSurface(theNurb);

The problem is that only the lower left corner of my NURBS is textured.
(seems that only 4 control point are taken into account)
The rest of the NURBS doesn't appear on the screen.

If I do something like :

gluNurbsSurface(theNurb,
13, knots13, 13, knots13,
2*2, 2, &texpoints[0][0][0],
2, 2, GL_MAP2_TEXTURE_COORD_2);


All the NURBS appear but the texturing is "not normal" and the texture seems clamped
in all directions.

Rob The Bloke
02-27-2002, 05:02 PM
do a search on the forum.