djk's picture

Glu NURBS Curve and Surface example

I had the need to start working with Glu.Nurbs curves and surfaces this week.

To get a handle on the structures and procedures involved, I created a simple OpenTK example for using Glu.NurbsCurves and Glu.NurbsSurfaces. It's built using the example framework and the SVN revision 1324 of OpenTK. The Curve and surface data is from a RedBook example, if this is a problem, I can change the data.

Please consider this as my first contribution to OpenTK.

djk

[Edit] I started to add trimming curves to the surface and the parameter GLU_MAP1_TRIM_2 is missing from the MapTarget enum.

[Edit2] It looks like the GLU_MAP1_TRIM_2 is actually a NurbsTrim.Map1Trim2, the Glu.NurbsCurve does not have a signature that is compatible with a NurbsTrim. I have not figured out how to add the missing overload.

I have updated the drawing code to allow trimming and commented out the trimming operation, its in the rev1 zip file.

AttachmentSize
W06_GluNurbs_rev6.zip7.46 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
djk's picture

Today when I began implementing the NurbsSurface object in our application I wrapped the glu calls for the nurbs surface into a display list and it works well.

I also found an issue with the stride for non-square grids of control points, I am at this moment testing an algorithm for computing the stride from the Nurbs data.

I will back these items into the example later tonight and update the zip file.

djk's picture

Trimming curves do not seem to work in a display list, I am researching to see if this is by design.

I fixed the stride issues for non-square grids of control points.

I noticed this afternoon that when the tessellation parameter is set to path length the tessellation of the surface is dependent on the current view transformation. Using the domain distance (ie number of u and v divisions) the tessellation is independent of the view transformation.

I have posted a cleaned up rev6.