Login  Register

Re: How to Draw a Smooth Curve through a Set of 2D Points

Posted by Xerxes Rånby on Feb 27, 2017; 2:08pm
URL: https://forum.jogamp.org/How-to-Draw-a-Smooth-Curve-through-a-Set-of-2D-Points-tp4037677p4037680.html

I assume you are using Tomas Hrasky's example code from 2007 contributed when he was a student at the University of Hradec Králové in the Czech Republic. Thomas example code is found in:
jogl-demos/src/demos/nurbs
http://jogamp.org/git/?p=jogl-demos.git;a=tree;f=src/demos/nurbs;hb=HEAD

The jogl-demos git have unfortunally not been updated to reflect the latest changes to jogl

I am using jogl-fat.jar
But   it gives error com.jogamp.opengl.util.GLUT

the class you are looking for have been move and is now found here:
import com.jogamp.opengl.util.gl2.GLUT
 
Also there is no such method glu.gluNewNurbsRenderer() in glu

Use the class
import com.jogamp.opengl.glu.gl2.GLUgl2
it contain the function gluNewNurbsRenderer()

If you update jogl-demos to use the above class imports please return a patch so that we can update jogl-demos to match the latest JogAmp JOGL release.

---

Inside the main JOGL source tree we also have the "graph" API that is what we consider the *best* way to render nurbs on all GPU's using a patent free shaders implementation.
Graph is suitable for both desktop and mobile GPU processors.

In a nutshell the JogAmp Graph API enable you to define nurbs shapes
Outline → OutlineShapes → GLRegion
and then render the shapes using a Renderer
RegionRenderer
TextRenderer (same as RegionRender with Helper methods for texts and fonts.)

outline.addVertex(x, y, z, w, onCurve);
outlineShape.addOutline(outline);
region = GLRegion.create(outlineShape, getRenderModes());
region.render(gl, outlineShape,...);


The best documentation for the graph API is found in the JOGL junit tests

and javadoc for Outline and OutlineShape .. and all classes i mentioned above..


Cheers
Xerxes