Interfacing JOGL with other programs for Nurbs

I have been using JOGL for the past few months and I like it.
Then I found that I need extensive support for drawing and interacting with
nurbs surfaces. Since JOGL does not support nurbs, I have been looking at various
options to make JOGL draw or work with other programs to draw nurbs.
I list below various options I have been considering and the related problems.
I appreciate your responses. I do not know much about implementation of JOGL and
glu.

  1. I have been trying to build a native interface between JOGL and glu.
    This is turning out to be very hard.

    a. glu generates large number of points for a surface. How do we pass them to JOGL using JNI?
    We also need to pass the current context from JOGL to glu. How do we
    do this? I am not sure which parameters to pass.

    b. Has anyone used either gluegen or noodleglue to build the interface between JOGL and glu?
    Is there a simple way to build such an interface?

  2. The other approach I have been thinking is to link JOGL with nurbs programs written in java or other java APIs.

    a. C code avaialble to implement nurbs algorithms (not using glu). One can convert it into a Java program. Is there
    a simple way to make the nurbs java program to interact with the JOGL pipeline? To interact with
    with the surfaces generated by the program (for selection, feedback and morphing), it is necessary
    to have a close integration between the java program and jogl. How can this be done?

    b. There are some APIs that can render nurbs. These include GL4JAVA, jGL, JGeom, etc. How can we make
    JOGL interact with these programs (for rendering, selection, feedback and morphing)?

If you can suggest any other simpler way to bring in nurbs into JOGL, it will help my work.

Thanks,
Prabhakar

It isn’t necessary to pass a context from JOGL to glu. glu assumes a context is current at the time it is invoked, which is true in the GLEventListener’s callbacks, when nurbs rendering would be done.

GlueGen can trivially produce the glue code for the nurbs functions but not the callbacks. Maybe we should have given this more thought when writing GlueGen, or done the nurbs routines by hand. Looking at gl4java it is clear that that API exposed the nurbs callbacks, so it should be possible to do in JOGL.

The approach we had been planning to take in JOGL was to port the nurbs source code from GLU up to Java. All of the other parts of GLU have already been ported to Java and this solves problems such as crashes on some Linux distributions. However the GLU nurbs code is larger than all of the other parts of GLU combined and it is a huge task. There is some intermediate (non-functional) work on this in the JOGL source tree, but it would take a long time to get this port working. You would probably be better off interfacing to the native routines.

You can easily render random 3D points using jogl, so if you can tesselate your nurbs surface using Java code then you can just call OpenGL from within your GLEventListener’s callbacks.

Thinking about it again it probably wouldn’t be that difficult to interface to the native GLU nurbs code and this is probably the short-term approach we should take in JOGL.

Thanks Ken, I will work on using JNI. I will post my results and experiences once I have them.

Prabhakar