0

I want to draw 3D graphics by JOGL and Eclipse, but it's not working.
Could anybody help?

Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: com.jogamp.opengl.GLException: Profile GL_DEFAULT is not available on WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x3279cf]], but: []
    at com.jogamp.opengl.GLProfile.get(GLProfile.java:991)
    at com.jogamp.opengl.GLProfile.getDefault(GLProfile.java:722)
    at com.jogamp.opengl.awt.GLCanvas.<init>(GLCanvas.java:264)
    at com.jogamp.opengl.awt.GLCanvas.<init>(GLCanvas.java:231)
    at com.jogamp.opengl.awt.GLCanvas.<init>(GLCanvas.java:218)
    at edu.mines.jtk.ogl.GlCanvas.<init>(GlCanvas.java:45)
    at HelloDemo$1.<init>(HelloDemo.java:28)
    at HelloDemo.<clinit>(HelloDemo.java:28)
Pang
  • 9,564
  • 146
  • 81
  • 122
Xue Wen
  • 1
  • 1
  • This bug was fixed a long time ago. Which version of JOGL do you use? – gouessej Aug 19 '17 at 23:46
  • I used version 2.0 of JOGL ago. Now, I use version 2.3.2. After I add "jogl_desktop.dll", the program runs successfully. I think it was because of missing the file "jogl-all-natives-windows-i586.jar". What about your opinion? – Xue Wen Aug 20 '17 at 01:33
  • There is no need to add the native libraries one by one (except if a virus scanner or if a group policy prevents GlueGen from doing its job). You have to follow our instructions: http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE If it's too complicated, use only the fat JAR jogamp-fat.jar, it contains both the native libraries and the Java libraries, add in into the classpath and it should work flawlessly :) – gouessej Aug 22 '17 at 12:59
  • Thanks. I use only the fat JAR jogamp-fat.jar, but it's not working. Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: E:\JavaTest\eclipse-workspace\TestJTK\natives\windows-i586\\gluegen-rt.dll at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.load0(Unknown Source) at java.lang.System.load(Unknown Source) – Xue Wen Aug 24 '17 at 23:14
  • 1
    Ok, something (probably) prevents the automated native library loading from working on your machine. You have to disable the automated native library loading (it's explained in the JOGL user's guide) and to set the Java library path to the path of the directory containing the native libraries of GlueGen and JOGL. There is something called "native location" in Eclipse as far as I remember. You can try to disable your virus scanner to see whether it helps. – gouessej Aug 26 '17 at 23:30
  • There is another problem. I'm not sure that the toolkit you use is compatible with the latest version of JOGL, it seems to use an old build of JOGL 2, look at this: https://dhale.github.io/jtk/api/edu/mines/jtk/ogl/GlCanvas.html GLCanvas is no longer in javax.media.opengl.awt in JOGL 2.3.2. – gouessej Aug 26 '17 at 23:33
  • The latest version of MinesJTK uses JOGL 2.3.2: https://github.com/MinesJTK/jtk/blob/master/core/build.gradle#L12 It's not the culprit. – gouessej Aug 26 '17 at 23:36
  • Thanks. Now, I use jdk-8u121-windows-i586, the latest version of MinesJTK. After I add only the fat JAR jogamp-fat.jar into the classpath, it works flawlessly. – Xue Wen Aug 27 '17 at 10:47
  • Cool, it's an excellent piece of news :) I advise you to avoid keeping obsolete DLLs and libraries in your environment to avoid such problems in the future. In my humble opinion, it's important to use the classpath wisely and to avoid putting third party dependencies into directories affecting the JRE or the operating system. – gouessej Aug 28 '17 at 12:04
  • I had the same issue, here's what worked for me ( not my solution, it is written in the following link ): I went to https://github.com/jzy3d/jogl/issues/4#issuecomment-1004895538 , copied the text ( JVM flags ), then in Eclipse I right-clicked on my project, pressed 'Run-as' and then on 'Run-configurations', then went to 'Arguments' tab and under 'VM arguments', paste the copied JVM flags. – jacob12 Jun 08 '22 at 23:16

0 Answers0