GLUnurbsObj *theNurb;
theNurb = gluNewNurbsRenderer();
gluNurbsProperty(theNurb, GLU_SAMPLING_TOLERANCE, 5.0);
gluNurbsProperty(theNurb, GLU_DISPLAY_MODE, GLU_FILL);
//ctrPoint[] is an array containing the coordinate x,y,z of a grid size of 15*15.
// therefore, the # of control points is 15*15=225. The degree is 3 and
// the order is 4.The size of knot vector is 4+225 = 229.
void drawNurbs(){
float knots[229];
for (int i=0;i<114;i++)
{
knots[i] = 0;
}
for (int i=114;i<229;i++)
{
knots[i] = 1;
}
gluBeginSurface(theNurb);
gluNurbsSurface(theNurb, 229, knots, 229, knots, 15*3 , 3, &ctrPoint[0],
4, 4, GL_MAP2_VERTEX_3);
gluEndSurface(theNurb);
}
void display(){
drawNurbs();
}
上述法典并不可行。 图瓦卢的职能存在一些错误。 但我不知道我在哪里错了。 <代码>ctr Point[]为225*3。