NURBS (Non-Uniform Rational B-Splines) is a powerful way for creating complex curves and surfaces. It requires only a few control points and knot vectors rather than hundreds of sample points on the surface. That means we can mathematically describe a curve or surface using B-Splines or NURBS, instead of approximating it with small pieces of line segments or triangles. It sounds good to our developers who want to characterize their models in a more precise way.
OpenGL provides evaluators and NURBS interface for rendering these parametric models, but OSG doesn't for some efficiency and practicability considerations. Rendering NURBS curves and surfaces always costs more on the graphics hardware than using approximate polygons (LODs can be even better). But it can't stop us from implementing one ourself. In this recipe, we will derive from the osg::Drawable
class and execute OpenGL commands to draw NURBS surfaces during the rendering traversal of the scene graph....