Can someone, please, write short tutorial on using new-implemented NURBS functionality.
Thanks.
Can someone, please, write short tutorial on using new-implemented NURBS functionality.
Thanks.
You might have a look on the Nurbs demos. (look at http://www.java-gaming.org/forums/index.php?topic=17622.0 to compile).
Here is some code to draw a square using nurbs:
/** Knots used to draw a square with nurbs of degree 2. */
private static final float[] KNOTS_SQUARE = {-1.0f, -1.0f, 1.0f, 1.0f};
/** Control points used to draw a square with nurbs of degree 2. */
private static final float[] CP_POINTS_SQUARE = {-1.0f, -1.0f, 0.0f,
-1.0f, 1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
1.0f, 1.0f, 0.0f };
// get the glu object
GLU glu = new GLU();
// create a nurbs object
GLUnurbs nurbsObj = glu.gluNewNurbsRenderer();
// here we will draw a surface
glu.gluBeginSurface(nurbsObj);
// draw the square
glu.gluNurbsSurface(nurbsObj, KNOTS_SQUARE.length, KNOTS_SQUARE, KNOTS_SQUARE.length, KNOTS_SQUARE,
2 * 3, 3, CP_POINTS_SQUARE, 2, 2, GL.GL_MAP2_VERTEX_3);
glu.gluEndSurface(nurbsObj);
// gluDeleteNurbsRenderer is not implemented yet(?).
nurbsObj = null;
If you need more information about glu nurbs you might have a look on the glu reference manual:
http://www.opengl.org/documentation/specs/glu/glu1_3.pdf.
Good luck,
Jean-Baptiste