PDA

View Full Version : A question about NURBS



overmas
12-04-2001, 04:27 PM
I imitate some sample code to write a NURBS program. It can work well when there is not so much control points, like 24 * 15. But when the control points' number come to 25 * 15, it can't display anything? plz help me, thx. The code like this:

gluBeginSurface(theNurb);

GLfloat *knots = (GLfloat *)malloc(rows * 2 * sizeof(GLfloat));
GLfloat *it = knots;
for (i = 0;i < rows;i++)
*(it++) = 0.0;
for (i = 0;i < rows;i++)
*(it++) = 1.0;

GLfloat *knots1 = (GLfloat *)malloc(cols * 2 * sizeof(GLfloat));
GLfloat *it = knots1;
for (i = 0;i < cols;i++)
*(it++) = 0.0;
for (i = 0;i < cols;i++)
*(it++) = 1.0;

gluNurbsSurface(theNurb,
rows * 2, knots,
cols * 2, knots1,
cols * 3,
3,
ctlpoint,
rows, cols,
GL_MAP2_VERTEX_3);

gluEndSurface(theNurb);

//when rows more then 24, it will have problem.

btw: i want to know how to use gluNurbsCallback() to get the error msg. thx a lot.