Hi everyone,
I am encountering a "GLException: No default device available" error using JOGL (with both 2.3.2 or latest 2.4.0 RC) on my Ubunto 20 laptop with an Intel Graphics card. I searched for this error but found only old messages regarding raspberry pi issues. (I have put at the end of the message the detailled debug output when the error occurs). Do someone have an idea of what could be the origin of the issue ? For information, I use JOGL with VTK Java wrapping, working on "older" linux systems (with mesa or Nvidia drivers installed), so maybe it is due to an issue with newer version of Mesa ? (I have encounter before issues with the GLProfile not being correctly recognised on Linux, forcing to use the 2.4.0 RC to resolve the issue). Thank you in advance, Arnaud PS: output of lspci: "00:02.0 VGA compatible controller: Intel Corporation UHD Graphics (rev 02)" ---- The following debug is for a test with Java 11 but the same error appears with Java 8 GLProfile.initSingleton() - thread AWT-EventQueue-0 [2]: com.jogamp.opengl.GLProfile.initSingleton(GLProfile.java:216) [3]: com.jogamp.opengl.GLProfile.getProfileMap(GLProfile.java:2324) [4]: com.jogamp.opengl.GLProfile.get(GLProfile.java:1042) [5]: com.jogamp.opengl.GLProfile.get(GLProfile.java:1071) [6]: com.jogamp.opengl.GLProfile.getMaxProgrammable(GLProfile.java:847) [7]: com.artenum.cassandra.renderer.vtk.CassandraView.createCanvas(CassandraView.java:155) [8]: com.artenum.cassandra.renderer.vtk.CassandraView.lambda$new$0(CassandraView.java:145) [9]: java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313) [10]: java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770) [11]: java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) [12]: java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715) [13]: java.base/java.security.AccessController.doPrivileged(Native Method) [14]: java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) [15]: java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740) [16]: java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) [17]: java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) [18]: java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) [19]: java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) [20]: java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [21]: java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) guessX: <null> isSet false guessWayland: <null> isSet false guessGBM: </dev/dri/card0> exists true guessVCIVUsed: hasVCLib = false && !hasVC4ModLocation = !false && !hasDriCard0File = !true AWT-EventQueue-0 - Info: NativeWindowFactory.<init>: Type .egl.gbm custom / .egl.gbm native AWT-EventQueue-0 - NativeWindowFactory.initSingleton() JAWTUtil initialization (JAWT/JNI/...); SKIP_AWT_HIDPI false JAWTUtil.getJAWT(tryOffscreenLayer false, tryOnscreen true) Checking for Java2D/OpenGL support Java2D support: default GraphicsConfiguration = sun.java2d.xr.XRGraphicsConfig JOGL/Java2D OGL Pipeline active false, resourceCompatible false JAWTUtil: Has sun.awt.SunToolkit: awtLock/awtUnlock true, disableBackgroundErase true JAWTUtil: Has Java2D true JAWTUtil: Is headless false JAWTUtil: AWT Desktop hints 1 JAWTUtil: OffscreenLayer Supported: false - Required false DRMUtil.initSingleton() Info: NativeWindow native init passed DRMUtil.initSingleton(): drmDevice[/dev/dri/card0]: fd 44: has resources: true DRMUtil.initSingleton(): OK true, drmFd 44] Connector 0/3 chosen true,: id[con 0x56, enc 0x55], type 14[id 0x1], connection 1, dim 310xaa mm, modes 1, encoders 1 Connector 1/3 chosen false,: id[con 0x5c, enc 0x0], type 11[id 0x1], connection 2, dim 0x0 mm, modes 0, encoders 1 Connector 2/3 chosen false,: id[con 0x64, enc 0x0], type 11[id 0x2], connection 2, dim 0x0 mm, modes 0, encoders 1 Connector[0].Mode 0/1 (max-chosen 0): clock 147840, 1920x1080 @ 60 Hz, type 72, name <1920x1080> Connector[0].Encoder 0/3 chosen true: id 0x55, type 2, crtc_id 0x30, possible[crtcs 7, clones 1] Connector[0].Encoder 1/3 chosen false: id 0x5b, type 2, crtc_id 0x0, possible[crtcs 7, clones 2] Connector[0].Encoder 2/3 chosen false: id 0x63, type 2, crtc_id 0x0, possible[crtcs 7, clones 4] Connector[0]: id[con 0x56, enc 0x55], type 14[id 0x1], connection 1, dim 310xaa mm, modes 1, encoders 1 Connector[0].Mode: clock 147840, 1920x1080 @ 60 Hz, type 72, name <1920x1080> Connector[0].Encoder: id 0x55, type 2, crtc_id 0x30, possible[crtcs 7, clones 1] NativeWindowFactory.registerFactory() interface com.jogamp.nativewindow.NativeWindow -> jogamp.nativewindow.NativeWindowFactoryImpl@7eca6308 NativeWindowFactory.registerFactory() class java.awt.Component -> jogamp.nativewindow.NativeWindowFactoryImpl@7eca6308 NativeWindowFactory requiresToolkitLock true, desktopHasThreadingIssues false NativeWindowFactory isAWTAvailable true, defaultFactory jogamp.nativewindow.NativeWindowFactoryImpl@7eca6308 AWT-EventQueue-0 - Info: GraphicsConfigurationFactory.<init> AWT-EventQueue-0 - GraphicsConfigurationFactory.initSingleton() GraphicsConfigurationFactory.registerFactory() put DeviceCapsType[com.jogamp.nativewindow.AbstractGraphicsDevice, com.jogamp.nativewindow.CapabilitiesImmutable] -> jogamp.nativewindow.DefaultGraphicsConfigurationFactoryImpl@66c6104e, overridding: null GLProfile.init - thread: AWT-EventQueue-0 ----------------------------------------------------------------------------------------------------- Platform: LINUX / Linux 5.4.0-42-generic (5.4.0), amd64 (X86_64, GENERIC_ABI), 8 cores, littleEndian true MachineDataInfo: runtimeValidated true, 32Bit false, primitive size / alignment: int8 1 / 1, int16 2 / 2 int 4 / 4, long 8 / 8 int32 4 / 4, int64 8 / 8 float 4 / 4, double 8 / 8, ldouble 16 / 16 pointer 8 / 8, page 4096 Platform: Java Version: 11.0.8 (11.0.8u0), VM: OpenJDK 64-Bit Server VM, Runtime: OpenJDK Runtime Environment Platform: Java Vendor: Ubuntu, https://ubuntu.com/, JavaSE: true, Java9: true, Java6: true, dynamicLib: true, AWT enabled: true ----------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------- Package: com.jogamp.gluegen Extension Name: null Specification Title: null Specification Vendor: null Specification Version: null Implementation Title: null Implementation Vendor: null Implementation Vendor ID: null Implementation URL: null Implementation Version: null Implementation Build: null Implementation Branch: null Implementation Commit: null Implementation SHA Sources: null Implementation SHA Classes: null Implementation SHA Classes-this: null Implementation SHA Natives: null Implementation SHA Natives-this: null ----------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------- Package: com.jogamp.nativewindow Extension Name: null Specification Title: null Specification Vendor: null Specification Version: null Implementation Title: null Implementation Vendor: null Implementation Vendor ID: null Implementation URL: null Implementation Version: null Implementation Build: null Implementation Branch: null Implementation Commit: null Implementation SHA Sources: null Implementation SHA Classes: null Implementation SHA Classes-this: null Implementation SHA Natives: null Implementation SHA Natives-this: null ----------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------- Package: com.jogamp.opengl Extension Name: null Specification Title: null Specification Vendor: null Specification Version: null Implementation Title: null Implementation Vendor: null Implementation Vendor ID: null Implementation URL: null Implementation Version: null Implementation Build: null Implementation Branch: null Implementation Commit: null Implementation SHA Sources: null Implementation SHA Classes: null Implementation SHA Classes-this: null Implementation SHA Natives: null Implementation SHA Natives-this: null ----------------------------------------------------------------------------------------------------- GLDrawableFactory.static - No native Windowing Factory for: .egl.gbm; May use EGLDrawableFactory, if available. Info: GLDrawableFactory.static - Desktop GLDrawableFactory unspecified! Info: EGLDrawableFactory: EGL ES2 - NOPE Info: EGLDrawableFactory: EGL ES1 - NOPE (ES1 lib) Info: EGLDrawableFactory: EGL Gln - disabled! Info: GLProfile.init - Desktop GLDrawable factory not available Info: GLProfile.init - Mobile GLDrawable factory not available Info: GLProfile.init - Default device not available GLProfile.init addedAnyProfile false (desktop: false, mobile false) GLProfile.init isAWTAvailable true GLProfile.init hasDesktopGLFactory false GLProfile.init hasGL234Impl false GLProfile.init hasMobileFactory false GLProfile.init hasGLES1Impl false GLProfile.init hasGLES3Impl false GLProfile.init hasGL234OnEGLImpl false GLProfile.init defaultDevice null GLProfile.init defaultDevice Desktop null GLProfile.init defaultDevice Mobile null GLProfile.init profile order [GL4bc, GL3bc, GL2, GL4, GL3, GLES3, GL4ES3, GL2GL3, GLES2, GL2ES2, GLES1, GL2ES1] Exception in thread "AWT-EventQueue-0" com.jogamp.opengl.GLException: No default device available at com.jogamp.opengl.GLProfile.getProfileMap(GLProfile.java:2327) at com.jogamp.opengl.GLProfile.get(GLProfile.java:1042) at com.jogamp.opengl.GLProfile.get(GLProfile.java:1071) at com.jogamp.opengl.GLProfile.getMaxProgrammable(GLProfile.java:847) |
Sorry for the second post but by continuing my tests, I just realised that my program does not work when launched via Eclipse, but works without issue when launch in "standalone".
So the issue is less inconvenient, but it may help other people that encounter this issue. Arnaud |
Administrator
|
Hello
Which JAR do you use? For sure, it's not loading a JAR provided by the JogAmp community as the specification and implementation properties aren't set.
Julien Gouesse | Personal blog | Website
|
This post was updated on .
Hello,
Thank you for your feedback, I use the jar from here: https://jogamp.org/deployment/v2.4.0-rc-20200307/ But, I think I forgot to mention I am in OSGi context, so the JAR is embedded into another one with correct OSGi metadata. Maybe the issue is coming from here, I will look in details the JOGL JAR and try to correctly propagate properties in OSGi context. Thanks, Arnaud --- EDIT: propagating implementation details does not change the behaviour. The main difference between working (not in eclipse) and not working (in eclipse) seems to be this line: In Eclipse: GLDrawableFactory.static - No native Windowing Factory for: .egl.gbm; May use EGLDrawableFactory, if available. Standalone: GLDrawableFactory.static - Native OS Factory for: .x11: jogamp.opengl.x11.glx.X11GLXDrawableFactory |
Administrator
|
I have used JOGL in Eclipse since 2006, I used JOGL with OSGI in 2009. In my humble opinion, there is nothing wrong in JOGL itself. I didn't have to embed JOGL JARs into other ones, it's not necessary, please don't do that, you're only driving things more complicated that they need to. Please use jogamp-fat.jar as is, without change, without any embedding and it will just work. I think that JOGL fails to extract and load some native libraries, it supports some fixed layouts. If the native libraries aren't in the expected locations in the JAR(s), it won't find them.
Wade Walker is more experienced than me with OSGI, maybe you should look at his tutorials.
Julien Gouesse | Personal blog | Website
|
Administrator
|
In reply to this post by atrch
One thing that might be worth trying: to help JOGL run inside frameworks like Eclipse, we added the JAR resolver functionality. In my Eclipse RCP app, I do this in createPartControl() of the editor that instantiates the GLCanvas:
JarUtil.setResolver( new JarUtil.Resolver() { public URL resolve( URL url ) { try { URL urlUnresolved = FileLocator.resolve( url ); URL urlResolved = (new URI( urlUnresolved.getProtocol(), urlUnresolved.getPath(), null )).toURL(); return( urlResolved ); } catch( IOException ioexception ) { return( url ); } catch( URISyntaxException urisyntaxexception ) { return( url ); } } } ); This allows JOGL to find its native libraries when invoked from inside a JAR that it doesn't expect by default. If you set a breakpoint in this code, you can see that the URLs have a strange syntax that I use Eclipse's FileLocator to decode into normal filesystem paths. |
Thank you both for your answers.
1) Wade: thank you for your insights, but maybe I was not clear, I do not use the Eclipse framework for OSGi, just running an OSGi app (using Apache Felix) directly in Eclipse for debuging purposes. If I understand well, the code you provided rely on Eclipse RCP (the "FileLocator" seems an Eclipse class). 2) Julien: Concerning OSGi, maybe I did not found the correct jars but the jogl-all or jogl-fat 2.4.0-RC do not have OSGi metadata and cannot be directly used in an OSGi container (I use Apache Felix). I have found in this thread (http://forum.jogamp.org/JOGL-with-OSGi-td3773888.html), a message from Wade explaining that "The trick I use is creating a project/bundle for JOGL that contains the gluegen and JOGL JARs, then creating fragment projects/bundles for each of the native platforms.", that's what I 'm doing. That's why I am wrapping JOGL into an OSGi capable jar (one per each platform, in the current case, linux 64). But I looked more into details my wrapping and noticed that there are new natives for linux (in 2.4.0 ? or maybe before but I never noticed) that were missing in my OSGi wrapping, so I apologize for the question, the error was totally on my side. Now in Eclipse, I don't get the same error as before, but the following one, that seems more strange. Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: com.jogamp.nativewindow.DefaultGraphicsConfiguration cannot be cast to com.jogamp.nativewindow.awt.AWTGraphicsConfiguration at com.jogamp.opengl.awt.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:1513) at com.jogamp.opengl.awt.GLCanvas.addNotify(GLCanvas.java:609) at java.awt.Container.addNotify(Container.java:2776) at javax.swing.JComponent.addNotify(JComponent.java:4740) at java.awt.Container.addNotify(Container.java:2776) at javax.swing.JComponent.addNotify(JComponent.java:4740) at java.awt.Container.addNotify(Container.java:2776) ... This error appears when the frame.setVisible(true) method is called. But as it is not mandatory for me to make JOGL works in Eclipse so I would totally understand if you cannot help me with my issue. Once again, thank you all for helping me. Arnaud |
Administrator
|
Hi Arnaud, my point about the FileLocator is not that you need to use that specific class, it's that you should check the JarResolver to see how JOGL is trying to find itself when invoked from inside your OSGi app. If JOGL is invoked from inside a "strange" environment where the classpath is a path to the inside of a JAR file (instead of being a plain file:// URL of a .class file), then JOGL may be unable to automatically unpack its native binaries to the hidden temp cache directory that it uses.
But on the other hand, if you're making your own bundles/fragments like I used to do for Eclipse, maybe this step is not needed. But I think in that case you may need to turn off JOGL's native library cache so it'll use your copies of the native libs, wherever you've put them. |
Thank you for your precision.
I have finally found the origin of the issue. It was not a JOGL issue at all but another component that was erasing all environnement vars in Java instead of just adding one environnement variable. For information, the way to set environnement vars was inspired by this StackOverflow tread: https://stackoverflow.com/questions/318239/how-do-i-set-environment-variables-from-java The most upvoted answer caused issue when used with JOGL. Details on how/why are in Tim Ryan post in this thread (and his solution works like a charm with the other component). Sorry for the incovenience, as the issue was not JOGL at all but your answers helped me a lot find the culprit, so thank you very much Arnaud |
Administrator
|
Hello Arnaud
The most upvoted answer on StackOverflow mentions a dirty solution that should be used only for testing and never in production anyway.
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |