View Full Version : OpenGL doubts

11-29-2012, 06:04 AM
Hi everyone, i'm posting here hoping to solve a problem.

I'm trying, using an example from the redbook, to create
the nurbs of a cylinder.
I have all the parameters (knots, cntrlpoints, weights)
but i'm not sure how to pass them in the code.
I've a couple of doubts regarding the definitions given in the redbook:

void gluNurbsSurface (GLUnurbsObj *nobj, GLint uknot_count,
GLfloat *uknot, GLint vknot_count, GLfloat *vknot,
GLint u_stride, GLint v_stride, GLfloat *ctlarray,
GLint uorder, GLint vorder, GLenum type);

- what are u_stride and v_stride? The book wasn't really clear.

- are uorder and vorder the degrees of the curves?

- do i have to use GL_MAP2_VERTEX_4 because i have {x,y,z,w} in my control points?

12-02-2012, 02:58 PM
It has been a long while since I have used GLU NURBS. I think u_stride is the stride in the u direction (u_order * vertex_size).
If you have 4 control points and each is XYZ, then your u_stride is 4 * 3.
If you are using XYZW, in your case it would be 4 * 4.

I think u_order was degree+1 in the u direction. If you have 4 control points in the u direction, it would be u_order = 4.