Cardinal
04-17-2001, 08:05 PM
I have a subtle error in my spline code... the knots array is set to { 0,0,0,0,1,1,1,1 } and the total is set outside the code. I can't tell if my error is in my array allocation, filling, or call to gluNurbsCurve... both 'Selected's are correct in the linked-list I am using (I know its slow...) The only thing I have noticed so far, is that when I have 3 control points, I see a line from the last point to the coordinate of the first control points x, seconds y, and thirds z... If anyone has any suggestion, I would appreciate them. http://www.opengl.org/discussion_boards/ubb/confused.gif
GLfloat *points = (GLfloat *)malloc(4 * total * sizeof(GLfloat));
Selected->GetHead();
for(int index=0; index < total*4; index++){
//accesses elements of individual points
points[index] = Selected->Selected->v[index%4];
Selected->GetNext();
}
GLUnurbsObj *theNurb = gluNewNurbsRenderer();
gluBeginCurve(theNurb);
gluNurbsCurve(theNurb,8,knots,4,points,total,GL_MA P1_VERTEX_4);
gluEndCurve(theNurb);
gluDeleteNurbsRenderer(theNurb);
GLfloat *points = (GLfloat *)malloc(4 * total * sizeof(GLfloat));
Selected->GetHead();
for(int index=0; index < total*4; index++){
//accesses elements of individual points
points[index] = Selected->Selected->v[index%4];
Selected->GetNext();
}
GLUnurbsObj *theNurb = gluNewNurbsRenderer();
gluBeginCurve(theNurb);
gluNurbsCurve(theNurb,8,knots,4,points,total,GL_MA P1_VERTEX_4);
gluEndCurve(theNurb);
gluDeleteNurbsRenderer(theNurb);