Trying to use JOGL in Matlab

5 views (last 30 days)
Hi there. I've been trying to get this to work all day and have had no luck...
I have a bit of Java which simply displays a triangle on a black background. It works fine in netbeans.
So in Matlab, I have added the 'libjogl_desktop.jnilib' to the library path, and the 'gluegen-rt.jar' and 'jogl-all.jar' to the dynamic classpath. Every time I try to call the function which should produce the graphics I get either
>> netbeans_jogl.Netbeans_jogl.main
??? Java exception occurred:
java.lang.UnsatisfiedLinkError:
jogamp.common.jvm.JVMUtil.initialize(Ljava/nio/ByteBuffer;)Z
at jogamp.common.jvm.JVMUtil.initialize(Native Method)
at jogamp.common.jvm.JVMUtil.<clinit>(JVMUtil.java:58)
at
com.jogamp.common.os.Platform.<clinit>(Platform.java:185)
at
javax.media.opengl.GLProfile.<clinit>(GLProfile.java:91)
at
netbeans_jogl.Netbeans_jogl.main(Netbeans_jogl.java:28)
or
>> netbeans_jogl.Netbeans_jogl.main()
??? Java exception occurred:
java.lang.NoClassDefFoundError: Could not initialize class
javax.media.opengl.GLProfile
at
netbeans_jogl.Netbeans_jogl.main(Netbeans_jogl.java:28)
Like I said I have been trying to get this to work for about 8 hours now, and am really not sure what I'm doing wrong. Any help greatly appreciated.
Felix.

Accepted Answer

Malcolm Lidierth
Malcolm Lidierth on 7 Jul 2012
Edited: Malcolm Lidierth on 7 Jul 2012
MATLAB ships with JOGL 1.1.1 on the static javaclasspath. I'm rusty, but recollect javax.media.opengl.GLProfile is JOGL2. To use that, you need to replace JOGL1 in classpath.txt and update the shared libraries in your matlabroot/bin/$arch folder. N.B. I have no idea whether that will break any MATLAB code using JOGL1.
It works with jzy3d 0.8 or 0.9 but for 0.9 you need to replace the MATLAB-shipped JOGL version as above.
Added: The Netbeans plugin looks still to be 1.1.1 so I must be wrong on GLProfile bit but the rest is OK. Use plain JOGL - not a netbeans plugin from MATLAB (I have not checked recently but MATLAB did not like Netbeans "wrapped" jars a few years ago).

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by