Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: OpenGL doubts

  1. #1
    Newbie Newbie
    Join Date
    Nov 2012

    OpenGL doubts

    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?

  2. #2
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Montreal, Canada
    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.
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts