English 中文(简体)
n鱼表面没有露天 GL
原标题:the nurbs surface does not show up in openGL
  • 时间:2011-11-10 23:49:27
  •  标签:
  • opengl
  • glu
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。

最佳回答

我发现这些问题。

(1) 第1条<代码>4 要素0!

(2) k数应为15+4 =19,而不是229!

GLfloat ctrlpoints[s_count][t_count][type]; //ctrlPoints[15][15][3]
GLfloat sknot[sknot_count];                 
GLfloat tknot[tknot_count];

之后

sknot_count = s_count + sorder; // 19 = 15+4
tknot_count = t_count + torder; // 19=15+4
问题回答

暂无回答




相关问题
OpenGL 3D Selection

I am trying to create a 3D robot that should perform certain actions when certain body parts are clicked. I have successfully (sort of) implemented picking in that if you click on any x-plane part, it ...

CVDisplayLink instead of NSTimer

I have started to implement cvDisplayLink to drive the render loop instead of nstimer, as detailed in this technical note https://developer.apple.com/library/archive/qa/qa1385/_index.html Is it ...

Can the iPhone simulator handle PVR textures?

I have a really weird problem with PVR textures on the iPhone simulator- the framerate falls through the floor on the iPhone simulator, but on the iPhone itself it works just fine. Has anyone had any ...

Calculate fps (frames per second) for iphone app

I am using an opengl es iphone application. What is the most accurate way to calculate the frames per second of my application for performance tuning?

Java - Zoom / 3D Data Visualization Libraries

What are the best libraries/frameworks for doing 3D and/or Zoom interfaces in Java? I d like to be able to do some prototyping of creating new types of interfaces for navigating within data and ...

FLTK in Cygwin using Eclipse (Linking errors)

I have this assignment due that requires the usage of FLTK. The code is given to us and it should compile straight off of the bat, but I am having linking errors and do not know which other libraries ...

热门标签