My answer is not published because I sent a too big image. Please find it below without image :
We access OpenGL through native bindings generated by JExtract, from project Panama. These bindings are packaged as a library visible here (https://gitlab.com/jzy3d/panama-gl). The -XstartOnFirstThread option is needed by OpenGL on macOS as OpenGL invocation MUST be performed from macOS main thread. Not using this option on macOS lead to an error java[92246:2751169] GLUT Fatal Error: internal error: NSInternalInconsistencyException, reason: NSWindow drag regions should only be invalidated on the Main Thread! Using this option on macOS lead to a freeze in LockSupport.park() (see the attached image for the complete call stack) JOGL has a smart way of solving this with a class allowing to push Runnables to macOS main thread (https://github.com/jzy3d/jogl/blob/ecf6e499d3b582d651a28693c871ca14d6e8c991/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java#L305) based on ObjectiveC code from Apple's AppKit framework (https://github.com/jzy3d/jogl/blob/ecf6e499d3b582d651a28693c871ca14d6e8c991/src/nativewindow/native/macosx/OSXmisc.m#L1167). This allows running on Swing without having to use the -XstartOnFirstThread. However JOGL has several issues, one of these being that it freezes JVM>=19 as soon as it appears in the classpath (for other reasons than the one discussed above). This issue is a real pain for anyone publishing applications involving OpenGL in Swing - whatever the OpenGL binding framework. Not solving the issue would make project Panama unusable for computer graphics. Regards, Martin Envoyé avec la messagerie sécurisée Proton Mail. ------- Original Message ------- Le mardi 14 mars 2023 à 19:18, Sergey Bylokhov <[email protected]> a écrit : > On 3/14/23 10:38, Martin Pernollet wrote: > > > I work on projects involving OpenGL in Swing. > > > > We are hitting anold JDK issue that prevent to properly run OpenGL on > > macOS+Swing > > https://bugs.openjdk.org/browse/JDK-8289573. > You may know that Swing > > hangs on macOS when using -XstartOnFirstThread option. However, this option > > is mandatory for native OpenGL to work on macOS (the reason is that OpenGL > > is single threaded and > > that macOS impose to have all calls to OpenGL issued on the main macOS > > thread). > > > Can you please add some details on what issue did you hit. That option is not > needed when the app > uses the built-in AWT/Swing, do your application use some external libraries > like JOGL, SWT or JavaFX? > > -- > Best regards, Sergey.
