Trying to use JOGL in Matlab

4 次查看(过去 30 天)
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.

采纳的回答

Malcolm Lidierth
Malcolm Lidierth 2012-7-7
编辑:Malcolm Lidierth 2012-7-7
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).

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Java Package Integration 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by