From 7d05fbdd341e41715e0903d43113d0b6ffbe1737 Mon Sep 17 00:00:00 2001 From: rickard Date: Sun, 30 Aug 2026 10:36:16 +0200 Subject: [PATCH 1/5] update to jmonkeyengine 3.10.0-beta2 --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 68e8cf93..1bb80105 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ # Version number used for plugins, only 3 numbers (e.g. 3.1.3) -jmeVersion = 3.9.0 +jmeVersion = 3.10.0 # Version used for application and settings folder, no spaces! -jmeMainVersion = 3.9 +jmeMainVersion = 3.10 # Version addition pre-alpha-svn, Stable, Beta -jmeVersionTag = stable +jmeVersionTag = beta2 # Increment this each time jmeVersionTag changes but jmeVersion stays the same #jmeVersionTagID = 0 From 4fbb0542eee41063f87259fd04468c93ffd30e9c Mon Sep 17 00:00:00 2001 From: rickard Date: Mon, 31 Aug 2026 22:09:13 +0200 Subject: [PATCH 2/5] use lwjgl3 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 90c2c313..2ec49a9c 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,7 @@ dependencies { corelibs dep("org.jmonkeyengine:jme3-awt-dialogs:$jmeVersion-$jmeVersionTag", true, true) corelibs dep("org.jmonkeyengine:jme3-plugins-json:$jmeVersion-$jmeVersionTag", true, true) corelibs dep("org.jmonkeyengine:jme3-plugins-json-gson:$jmeVersion-$jmeVersionTag", true, true) - corelibs dep("org.jmonkeyengine:jme3-lwjgl:$jmeVersion-$jmeVersionTag", true, true) + corelibs dep("org.jmonkeyengine:jme3-lwjgl3:$jmeVersion-$jmeVersionTag", true, true) corelibs dep("org.jmonkeyengine:jme3-effects:$jmeVersion-$jmeVersionTag", true, true) corelibs dep("com.github.stephengold:Minie:9.0.3", true, true) // replacement for bullet-native corelibs dep("com.github.stephengold:Heart:9.3.0", true, true) // requirement for Minie From ad37156155d0fb08ac3f9e980809a82dd8d1e72c Mon Sep 17 00:00:00 2001 From: rickard Date: Sat, 7 Nov 2026 07:22:31 +0100 Subject: [PATCH 3/5] Fix SIGSEGV on SDK exit: keep glvnd's libEGL loaded Quit the SDK and the JVM died with SIGSEGV during process teardown, reliably, whenever the offscreen scene application had started: Current thread is native thread # C [libc.so.6+0x91651] <- __GI___nptl_deallocate_tsd SIGSEGV (SEGV_MAPERR) Root cause (proven via strace mmap/munmap correlation, a coredump backtrace and four hs_err logs with identical state; pthread key index 14 and the same destructor offset ...d30 in every sample): - GLFW (jME lwjgl3 backend) probes EGL besides GLX while creating the GL context for the offscreen scene application. - glvnd's libEGL.so.1 registers a pthread_key whose destructor points into its own text, and stores per-thread TSD data on the render thread that made the egl* calls. The key is never deleted. - At SDK shutdown GLFW terminates and dlcloses libEGL.so.1 (strace: munmap of its whole 75432-byte mapping during the teardown cascade). The registered destructor is now dangling. - When the render thread finishes and glibc runs the thread-exit TSD walker (__nptl_deallocate_tsd), it calls the stale destructor into the unmapped libEGL text -> SIGSEGV -> JVM fatal error. Timing-wise this is a race: occasionally the thread exits before the dlclose and the exit looks clean. Fix: hold our own dlopen reference on libEGL.so.1 at module startup (System.load in the jme3-core Installer, Linux only). GLFW's dlclose then merely drops its own reference: the library stays mapped until the JVM terminates and the destructor remains valid. Verified: traced runs before the fix crashed on every exit; with the pin, exits are clean (no hs_err, no coredump, libEGL never unmapped) across repeated straced and plain runs. A complete fix should also be pursued upstream (glvnd removing its pthread key on library unload, or GLFW not unloading libraries it probed). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- .../src/com/jme3/gde/core/Installer.java | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/jme3-core/src/com/jme3/gde/core/Installer.java b/jme3-core/src/com/jme3/gde/core/Installer.java index d6613bcf..8227f46a 100644 --- a/jme3-core/src/com/jme3/gde/core/Installer.java +++ b/jme3-core/src/com/jme3/gde/core/Installer.java @@ -35,6 +35,7 @@ import java.awt.Component; import java.awt.Frame; import java.io.File; +import java.util.Locale; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFileChooser; @@ -68,10 +69,47 @@ public void restored() { Logger.getLogger("org.openide.loaders").setLevel(Level.SEVERE); } + /** + * GLFW (used by the jME lwjgl3 backend) dlopen()s libEGL.so.1 while probing + * for GL context creation and dlclose()s it again when the context is + * destroyed at SDK shutdown. glvnd registers a pthread_key destructor that + * points into libEGL and never removes it. After the dlclose that destructor + * is dangling, and when the thread that touched EGL exits, glibc's + * __nptl_deallocate_tsd calls it and the JVM dies with SIGSEGV. + * Holding our own reference on the library keeps it mapped until the JVM + * itself terminates, so the destructor stays valid. No-op away from Linux. + */ + private static void holdEglLibraryReference() { + if (!System.getProperty("os.name", "").toLowerCase(Locale.ROOT).contains("linux")) { + return; + } + String[] candidates = { + "/usr/lib/x86_64-linux-gnu/libEGL.so.1", + "/usr/lib64/libEGL.so.1", + "/usr/lib/aarch64-linux-gnu/libEGL.so.1", + "/usr/lib/libEGL.so.1", + }; + for (String lib : candidates) { + if (new File(lib).canRead()) { + try { + System.load(lib); + Logger.getLogger(Installer.class.getName()) + .log(Level.INFO, "Holding {0} to prevent GLFW/glvnd unloading it at exit", lib); + return; + } catch (UnsatisfiedLinkError | RuntimeException ex) { + Logger.getLogger(Installer.class.getName()) + .log(Level.INFO, "Could not hold a reference on " + lib, ex); + } + } + } + } + static { //set exception report levels System.setProperty("netbeans.exception.report.min.level", "99999"); - System.setProperty("netbeans.exception.alert.min.level", "99999"); + System.setProperty("netbeans.exception.alert.min.level", "99999"); + //keep glvnd's EGL library mapped for the lifetime of the JVM (see holdEglLibraryReference) + holdEglLibraryReference(); //set http agent System.setProperty("http.agent", NbBundle.getBundle("org.netbeans.core.windows.view.ui.Bundle").getString("CTL_MainWindow_Title") + " (" + System.getProperty("os.name") + "/" + System.getProperty("os.version") + ")"); From f890edb790720459756e4cd788ab0032bc640785 Mon Sep 17 00:00:00 2001 From: rickard Date: Sat, 7 Nov 2026 07:37:11 +0100 Subject: [PATCH 4/5] Fix SIGSEGV on SDK exit: correct attribution, GLFW -> SDL3 The fix commit for the exit crash holds a dlopen reference on libEGL.so.1 to keep glvnd's pthread-key destructor valid. Its comments and log message blamed GLFW for the load/unload of libEGL. jME 3.10's lwjgl3 backend is SDL3-based (LWJGL 3.4 lwjgl-sdl bindings; there is no lwjgl-glfw on the SDK classpath): SDL probes the X11 and Wayland/EGL video backends when the GL context is created, and its video teardown (SDL_EGL_UnloadLibrary) dlcloses libEGL at shutdown, leaving the destructor dangling. Same crash, same pthread key, same fix - only the actor is SDL3, not GLFW. Wording-only change, no functional difference. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- .../src/com/jme3/gde/core/Installer.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/jme3-core/src/com/jme3/gde/core/Installer.java b/jme3-core/src/com/jme3/gde/core/Installer.java index 8227f46a..6a4c8a0f 100644 --- a/jme3-core/src/com/jme3/gde/core/Installer.java +++ b/jme3-core/src/com/jme3/gde/core/Installer.java @@ -70,14 +70,16 @@ public void restored() { } /** - * GLFW (used by the jME lwjgl3 backend) dlopen()s libEGL.so.1 while probing - * for GL context creation and dlclose()s it again when the context is - * destroyed at SDK shutdown. glvnd registers a pthread_key destructor that - * points into libEGL and never removes it. After the dlclose that destructor - * is dangling, and when the thread that touched EGL exits, glibc's - * __nptl_deallocate_tsd calls it and the JVM dies with SIGSEGV. - * Holding our own reference on the library keeps it mapped until the JVM - * itself terminates, so the destructor stays valid. No-op away from Linux. + * The jME lwjgl3 backend (jME 3.10, LWJGL 3.4) is SDL3-based. SDL probes the + * X11 and Wayland/EGL video backends when the GL context is created, which + * loads libEGL.so.1, and unloads that library again at SDK shutdown + * (SDL_EGL_UnloadLibrary). glvnd registers a pthread_key destructor that + * points into libEGL when the library is first used and never removes it. + * After the dlclose that destructor is dangling, and when the thread that + * touched EGL exits, glibc's __nptl_deallocate_tsd calls it and the JVM + * dies with SIGSEGV. Holding our own reference on the library keeps it + * mapped until the JVM itself terminates, so the destructor stays valid. + * No-op away from Linux. */ private static void holdEglLibraryReference() { if (!System.getProperty("os.name", "").toLowerCase(Locale.ROOT).contains("linux")) { @@ -94,7 +96,7 @@ private static void holdEglLibraryReference() { try { System.load(lib); Logger.getLogger(Installer.class.getName()) - .log(Level.INFO, "Holding {0} to prevent GLFW/glvnd unloading it at exit", lib); + .log(Level.INFO, "Holding {0} to prevent SDL/glvnd unloading it at exit", lib); return; } catch (UnsatisfiedLinkError | RuntimeException ex) { Logger.getLogger(Installer.class.getName()) From 5a9758ceb4cddd1d12b8798939752bb14eb55f37 Mon Sep 17 00:00:00 2001 From: rickard Date: Sun, 8 Nov 2026 20:23:19 +0100 Subject: [PATCH 5/5] Set PBR env when pressing light button. Remove PBR button --- .../jme3/gde/core/scene/SceneApplication.java | 11 +- .../sceneviewer/SceneViewerTopComponent.form | 31 ----- .../sceneviewer/SceneViewerTopComponent.java | 116 ++++++------------ 3 files changed, 42 insertions(+), 116 deletions(-) diff --git a/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java b/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java index 99327b32..dc8b7632 100644 --- a/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java +++ b/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 jMonkeyEngine All rights reserved.

+ * Copyright (c) 2009-2026 jMonkeyEngine All rights reserved.

* Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -196,7 +196,7 @@ public ViewPort getOverlayView() { private void loadFPSText() { BitmapFont font = assetManager.loadFont("Interface/Fonts/Default.fnt"); - fpsText = new BitmapText(font, false); + fpsText = new BitmapText(font); fpsText.setSize(font.getCharSet().getRenderedSize()); fpsText.setLocalTranslation(0, fpsText.getLineHeight(), 0); fpsText.setText("Frames per second"); @@ -234,7 +234,6 @@ public void initialize() { camLight = new PointLight(); camLight.setColor(ColorRGBA.White); - guiNode.setQueueBucket(Bucket.Gui); guiNode.setCullHint(CullHint.Never); loadFPSText(); @@ -535,9 +534,11 @@ public void enableCamLight(final boolean enabled) { if (enabled) { rootNode.removeLight(camLight); rootNode.addLight(camLight); + } else { rootNode.removeLight(camLight); } + enablePBRProbe(enabled); return null; }); } @@ -581,12 +582,12 @@ public void run() { }.start(); } - private void togglePbrProbe(final boolean selected, final Node activeNode) { + private void togglePbrProbe(final boolean enabled, final Node activeNode) { if (pbrLightProbe == null) { createPbrLightProbe(activeNode); } else { enqueue(() -> { - if (selected) { + if (enabled) { activeNode.addLight(pbrLightProbe); } else { activeNode.removeLight(pbrLightProbe); diff --git a/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.form b/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.form index d73cc2e2..36480f17 100644 --- a/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.form +++ b/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.form @@ -134,37 +134,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java b/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java index c91d3314..389f3ab1 100644 --- a/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java +++ b/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 jMonkeyEngine All rights reserved.

+ * Copyright (c) 2009-2026 jMonkeyEngine All rights reserved.

* Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -60,7 +60,7 @@ import org.openide.windows.WindowManager; /** - * This is the component containing the whole scene/model
+ * This is the component containing the whole scene/model * It also contains the top bar. */ @ConvertAsProperties(dtd = "-//com.jme3.gde.core.sceneviewer//SceneViewer//EN", @@ -90,42 +90,28 @@ public SceneViewerTopComponent() { oglCanvas.setFocusable(false); oGLPanel.add(oglCanvas); - } catch (Exception e) { + } catch (Exception | Error e) { SceneApplication.showStartupErrorMessage(e); - } catch (Error err) { - SceneApplication.showStartupErrorMessage(err); } - //TODO: camera tools (see SwitchFrontViewAction) -// Collection result = Lookups.forPath("CameraTools").lookupAll(Action.class); -// for (Iterator it = result.iterator(); it.hasNext();) { -// Action object = it.next(); -// //System.out.println("lookup object! / " + object); -// } - - //We add a mouse wheel listener to the top conmponent in order to correctly dispatch the event ot the cam controller - //the oGLPanel may naver have the focus. - // if ("true".equals(NbPreferences.forModule(Installer.class).get("use_lwjgl_canvas", "false"))) { - addMouseWheelListener(new MouseWheelListener() { - @Override - public void mouseWheelMoved(final MouseWheelEvent e) { - SceneApplication.getApplication().enqueue(new Callable() { - @Override - public Void call() throws Exception { - String action; - if (e.getWheelRotation() < 0) { - action = "MouseWheel"; - } else if (e.getWheelRotation() > 0) { - action = "MouseWheel-"; - } else { - return null; - } - if (app.getActiveCameraController() != null) { - app.getActiveCameraController().onAnalog(action, e.getWheelRotation(), 0); - } + + addMouseWheelListener((final MouseWheelEvent e) -> { + SceneApplication.getApplication().enqueue(new Callable() { + @Override + public Void call() throws Exception { + String action; + if (e.getWheelRotation() < 0) { + action = "MouseWheel"; + } else if (e.getWheelRotation() > 0) { + action = "MouseWheel-"; + } else { return null; } - }); - } + if (app.getActiveCameraController() != null) { + app.getActiveCameraController().onAnalog(action, e.getWheelRotation(), 0); + } + return null; + } + }); }); addKeyListener(new KeyListener() { @Override @@ -134,37 +120,30 @@ public void keyTyped(KeyEvent evt) { @Override public void keyPressed(final KeyEvent evt) { - SceneApplication.getApplication().enqueue(new Callable() { - @Override - public Void call() throws Exception { - int code = AwtKeyInput.convertAwtKey(evt.getKeyCode()); - KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), true, false); - keyEvent.setTime(evt.getWhen()); - if (app.getActiveCameraController() != null) { - app.getActiveCameraController().onKeyEvent(keyEvent); - } - return null; + SceneApplication.getApplication().enqueue(() -> { + int code = AwtKeyInput.convertAwtKey(evt.getKeyCode()); + KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), true, false); + keyEvent.setTime(evt.getWhen()); + if (app.getActiveCameraController() != null) { + app.getActiveCameraController().onKeyEvent(keyEvent); } + return null; }); } @Override public void keyReleased(final KeyEvent evt) { - SceneApplication.getApplication().enqueue(new Callable() { - @Override - public Void call() throws Exception { - int code = AwtKeyInput.convertAwtKey(evt.getKeyCode()); - KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), false, false); - keyEvent.setTime(evt.getWhen()); - if (app.getActiveCameraController() != null) { - app.getActiveCameraController().onKeyEvent(keyEvent); - } - return null; + SceneApplication.getApplication().enqueue(() -> { + int code = AwtKeyInput.convertAwtKey(evt.getKeyCode()); + KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), false, false); + keyEvent.setTime(evt.getWhen()); + if (app.getActiveCameraController() != null) { + app.getActiveCameraController().onKeyEvent(keyEvent); } + return null; }); } }); - //} oGLPanel.setDropTarget(new DropTarget(this, new SceneViewerDropTargetListener(this))); } @@ -182,7 +161,6 @@ private void initComponents() { jToggleButton1 = new javax.swing.JToggleButton(); jSeparator1 = new javax.swing.JToolBar.Separator(); enableWireframe = new javax.swing.JToggleButton(); - enablePBREnv = new javax.swing.JToggleButton(); enablePBRSky = new javax.swing.JToggleButton(); enableNormalView = new javax.swing.JToggleButton(); jPanel1 = new javax.swing.JPanel(); @@ -249,23 +227,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); jToolBar1.add(enableWireframe); - enablePBREnv.setIcon(IconList.enablePbrEnvironment); - org.openide.awt.Mnemonics.setLocalizedText(enablePBREnv, org.openide.util.NbBundle.getMessage(SceneViewerTopComponent.class, "SceneViewerTopComponent.enablePBREnv.text")); // NOI18N - enablePBREnv.setToolTipText(org.openide.util.NbBundle.getMessage(SceneViewerTopComponent.class, "SceneViewerTopComponent.enablePBREnv.toolTipText")); // NOI18N - enablePBREnv.setFocusable(false); - enablePBREnv.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - enablePBREnv.setMaximumSize(new java.awt.Dimension(32, 32)); - enablePBREnv.setMinimumSize(new java.awt.Dimension(32, 32)); - enablePBREnv.setPreferredSize(new java.awt.Dimension(32, 32)); - enablePBREnv.setSelectedIcon(IconList.enablePbrEnvironment); - enablePBREnv.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - enablePBREnv.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - enablePBREnvActionPerformed(evt); - } - }); - jToolBar1.add(enablePBREnv); - enablePBRSky.setIcon(IconList.enablePbrSky); org.openide.awt.Mnemonics.setLocalizedText(enablePBRSky, org.openide.util.NbBundle.getMessage(SceneViewerTopComponent.class, "SceneViewerTopComponent.enablePBRSky.text")); // NOI18N enablePBRSky.setToolTipText(org.openide.util.NbBundle.getMessage(SceneViewerTopComponent.class, "SceneViewerTopComponent.enablePBRSky.toolTipText")); // NOI18N @@ -334,10 +295,6 @@ private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GE FilterExplorerTopComponent.findInstance().setFilterEnabled(jToggleButton1.isSelected()); }//GEN-LAST:event_jToggleButton1ActionPerformed - private void enablePBREnvActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enablePBREnvActionPerformed - app.enablePBRProbe(enablePBREnv.isSelected()); - }//GEN-LAST:event_enablePBREnvActionPerformed - private void enablePBRSkyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enablePBRSkyActionPerformed app.enablePBRSkybox(enablePBRSky.isSelected()); }//GEN-LAST:event_enablePBRSkyActionPerformed @@ -349,7 +306,6 @@ private void enableNormalViewActionPerformed(java.awt.event.ActionEvent evt) {// // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JToggleButton enableCamLight; private javax.swing.JToggleButton enableNormalView; - private javax.swing.JToggleButton enablePBREnv; private javax.swing.JToggleButton enablePBRSky; private javax.swing.JToggleButton enableStats; private javax.swing.JToggleButton enableWireframe; @@ -388,8 +344,8 @@ public static synchronized SceneViewerTopComponent findInstance() { "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system."); return getDefault(); } - if (win instanceof SceneViewerTopComponent) { - return (SceneViewerTopComponent) win; + if (win instanceof SceneViewerTopComponent sceneViewerTopComponent) { + return sceneViewerTopComponent; } Logger.getLogger(SceneViewerTopComponent.class.getName()).warning( "There seem to be multiple components with the '" + PREFERRED_ID