Jogl demo compilation error

I recently download the latest version of Jogl and demos. Most of the demos work fine.
However, I found two demos are out dated.

demos.cg.runtime_ogl and demos.cg.runtime_ogl_vertex_fragment

It turn out that following no longer exist,

Context = CgGL.cgCreateContext();
CgGL.cgGLEnableProfile

Any suggestions?

Thanks,

Actually, I get the following error.

   // Create Cg Context
Context = CgGL.cgCreateContext();
CheckCgError();

demos.cg.runtime_ogl.cgGL_vertex_example

Exception in thread “AWT-EventQueue-0” java.lang.UnsatisfiedLinkError: C:\jdk1.5.0_06\jre\bin\jogl_cg.dll: The specified procedure could not be found

at java.lang.ClassLoader$NativeLibrary.load(Native Method)

at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)

at java.lang.Runtime.loadLibrary0(Runtime.java:822)

at java.lang.System.loadLibrary(System.java:992)

at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:78)

at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:101)

at com.sun.opengl.impl.NativeLibLoader.access$100(NativeLibLoader.java:47)

at com.sun.opengl.impl.NativeLibLoader$4.run(NativeLibLoader.java:151)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.opengl.impl.NativeLibLoader.loadCgImpl(NativeLibLoader.java:148)

at com.sun.opengl.cg.CgGL.<clinit>(CgGL.java:5412)

at demos.cg.runtime_ogl.cgGL_vertex_example.init(cgGL_vertex_example.java:191)

at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)

at javax.media.opengl.GLCanvas$InitAction.run(GLCanvas.java:264)

at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:189)

at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:258)

at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)

at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)

at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)

at sun.awt.RepaintArea.paint(RepaintArea.java:224)

at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)

at java.awt.Component.dispatchEventImpl(Component.java:4031)

at java.awt.Component.dispatchEvent(Component.java:3803)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

The problem is most likely that you haven’t installed NVidia’s Cg toolkit, required by these demos. You also need to make sure your hardware supports it. The Cg toolkit used to be NVidia-specific but I don’t think that’s true any more.

Ken,

I reinstall the Cg toolkit. I still run into the same problem. I used to run the demo without any problems. Did you try to run demos.cg.runtime_ogl.cgGL_vertex_example on your desktop?

Thanks,

Yes, I just upgraded to Cg 1.5 and both of the JOGL Cg demos work fine. Make sure the Cg DLLs are in your PATH (e.g. “C:/Program Files/NVidia Corporation/Cg/bin”), and don’t put the JOGL DLLs into your JDK – point to them with your PATH and to the jogl.jar with your CLASSPATH environment variable. Please see the JOGL User’s Guide.

Ken,

I follow exactly from the user guide. Add the CLASSPATH for jogl.jar and PATH for Cg. I use the Cg 1.5 and Jogl nightly build. I run into the same problems.

I doubt for the incompatibility issues between Cg 1.5 and new release Jogl.

Could you tell me exactly where you locate the .dll and window-586.jar files? If possible, clarify the classpath setup.

Thanks a lot,

My PATH includes the following directory


C:\Users\kbr\JavaNet\jogl\build\obj

as well as the directory containing the NVidia Cg DLLs, etc.

My CLASSPATH includes


C:\Users\kbr\JavaNet\jogl\build\jogl.jar
C:\Users\kbr\JavaNet\jogl-demos\build\jogl-demos.jar
C:\Users\kbr\JavaNet\jogl-demos\build\jogl-demos-data.jar
C:\Users\kbr\JavaNet\jogl-demos\build\jogl-demos-util.jar

The native library jar file (e.g., jogl-natives-windows-i586.jar) isn’t relevant any more; the JOGL downloads for developers are now in the format of platform-specific zip archives.

Ken,

I use JBuilder. I include all the .jar files in the required library. Compile is fine. When I run, I get the following error,
Exception in thread “AWT-EventQueue-0” java.lang.UnsatisfiedLinkError: no jogl_cg in java.library.path

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)

at java.lang.Runtime.loadLibrary0(Runtime.java:822)

at java.lang.System.loadLibrary(System.java:992)

at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:78)

at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:101)

at com.sun.opengl.impl.NativeLibLoader.access$100(NativeLibLoader.java:47)

at com.sun.opengl.impl.NativeLibLoader$4.run(NativeLibLoader.java:151)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.opengl.impl.NativeLibLoader.loadCgImpl(NativeLibLoader.java:148)

at com.sun.opengl.cg.CgGL.<clinit>(CgGL.java:5412)

at demos.cg.runtime_ogl.cgGL_vertex_example.init(cgGL_vertex_example.java:191)

at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)

at javax.media.opengl.GLCanvas$InitAction.run(GLCanvas.java:264)

at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:189)

at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:258)

at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)

at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)

at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)

at sun.awt.RepaintArea.paint(RepaintArea.java:224)

at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)

at java.awt.Component.dispatchEventImpl(Component.java:4031)

at java.awt.Component.dispatchEvent(Component.java:3803)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Then, I copy the jogl.dll, jogl_awt.dll, jogl_cg.dll to C:\jdk1.5.0_06\jre\bin.
During the running, I receive the following error,
Exception in thread “AWT-EventQueue-0” java.lang.UnsatisfiedLinkError: C:\jdk1.5.0_06\jre\bin\jogl_cg.dll: The specified procedure could not be found

at java.lang.ClassLoader$NativeLibrary.load(Native Method)

at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)

at java.lang.Runtime.loadLibrary0(Runtime.java:822)

at java.lang.System.loadLibrary(System.java:992)

at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:78)

at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:101)

at com.sun.opengl.impl.NativeLibLoader.access$100(NativeLibLoader.java:47)

at com.sun.opengl.impl.NativeLibLoader$4.run(NativeLibLoader.java:151)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.opengl.impl.NativeLibLoader.loadCgImpl(NativeLibLoader.java:148)

at com.sun.opengl.cg.CgGL.<clinit>(CgGL.java:5412)

at demos.cg.runtime_ogl.cgGL_vertex_example.init(cgGL_vertex_example.java:191)

at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)

at javax.media.opengl.GLCanvas$InitAction.run(GLCanvas.java:264)

at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:189)

at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:258)

at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)

at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)

at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)

at sun.awt.RepaintArea.paint(RepaintArea.java:224)

at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)

at java.awt.Component.dispatchEventImpl(Component.java:4031)

at java.awt.Component.dispatchEvent(Component.java:3803)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Any suggestions? It seems that the JBuilder can’t automatically grab the jogl.dll related files.

Thanks,

The first problem (where you needed to drop the JOGL DLLs into the JRE) you should instead solve by specifying the -Djava.library.path property somehow inside of JBuilder.

The second one is caused by an ancient version of Cg installed on your computer. I was able to produce this UnsatisfiedLinkError (“the specified procedure could not be found”) only by uninstalling Cg and reinstalling the old 1.3 Cg runtime. You need to uninstall all copies of Cg, check your computer for old versions of the Cg DLLs, delete them, and then install Cg 1.5 from NVidia’s web site.

Ken,

I follow what you suggest specify the -Djava.libarary.path in side JBuilder. Remove the old Cg. Install Cg 1.5. I still get the same error.
I use JSR-231 1.0.0 release.

Don’t know what’s happed.

thanks,

Exception in thread “AWT-EventQueue-0” java.lang.UnsatisfiedLinkError: C:\jogl\jogl-1_0_0-windows-i586\lib\jogl_cg.dll: The specified procedure could not be found

at java.lang.ClassLoader$NativeLibrary.load(Native Method)

at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)

at java.lang.Runtime.loadLibrary0(Runtime.java:822)

at java.lang.System.loadLibrary(System.java:992)

at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:78)

at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:101)

at com.sun.opengl.impl.NativeLibLoader.access$100(NativeLibLoader.java:47)

at com.sun.opengl.impl.NativeLibLoader$4.run(NativeLibLoader.java:151)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.opengl.impl.NativeLibLoader.loadCgImpl(NativeLibLoader.java:148)

at com.sun.opengl.cg.CgGL.<clinit>(CgGL.java:5412)

at demos.cg.runtime_ogl_vertex_fragment.runtime_ogl_vertex_fragment.init(runtime_ogl_vertex_fragment.java:107)

at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)

at javax.media.opengl.GLCanvas$InitAction.run(GLCanvas.java:264)

at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:189)

at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:258)

at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)

at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)

at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)

at sun.awt.RepaintArea.paint(RepaintArea.java:224)

at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)

at java.awt.Component.dispatchEventImpl(Component.java:4031)

at java.awt.Component.dispatchEvent(Component.java:3803)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Exception in thread “Thread-2” javax.media.opengl.GLException: java.lang.NoClassDefFoundError

at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271)

at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:256)

at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)

at com.sun.opengl.util.Animator.display(Animator.java:144)

at com.sun.opengl.util.Animator$MainLoop.run(Animator.java:181)

at java.lang.Thread.run(Thread.java:595)

Caused by: java.lang.NoClassDefFoundError

at demos.cg.runtime_ogl_vertex_fragment.runtime_ogl_vertex_fragment.display(runtime_ogl_vertex_fragment.java:154)

at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78)

at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:281)

at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:194)

at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:298)

at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

When this exception is thrown, use the Process Explorer tool to attach to the Java process and list the DLLs that are loaded. You should be able to track down which cgGL.dll and cg.dll are being loaded. I can almost guarantee to you that you have an old cg.dll or cgGL.dll sitting around somewhere which are being picked up incorrectly instead of the Cg 1.5 versions.

Ken,

I solve the problem now. It turns out that C:\WINDOWS\system32 hold the old cg.dll and cgGL.dll. The regular Cg uninstall program can’t delete the two files.

Thank your very much,

cat.