jMonkeyEngine / jmonkeyengine

A complete 3-D game development suite written in Java.
http://jmonkeyengine.org
BSD 3-Clause "New" or "Revised" License
3.83k stars 1.12k forks source link

TestCanvas crashes with LWJGL3 #1192

Closed stephengold closed 9 months ago

stephengold commented 5 years ago

Current master branch on Windows:

INFO JmeDesktopSystem 10:35:35 AM Running on jMonkeyEngine 3.3-6918
 * Branch: master
 * Git Hash: 46a52af
 * Build Date: 2019-09-20
SEVERE JmeDesktopSystem 10:35:35 AM CRITICAL ERROR: Context class is missing!
Make sure jme3_lwjgl-ogl is on the classpath.
java.lang.ClassNotFoundException: com.jme3.system.lwjgl.LwjglCanvas
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.jme3.system.JmeDesktopSystem.newContextLwjgl(JmeDesktopSystem.java:196)
    at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:279)
    at com.jme3.system.JmeSystem.newContext(JmeSystem.java:159)
    at com.jme3.app.LegacyApplication.createCanvas(LegacyApplication.java:510)
    at jme3test.awt.TestCanvas.createCanvas(TestCanvas.java:217)
    at jme3test.awt.TestCanvas.main(TestCanvas.java:248)
Exception in thread "main" java.lang.NullPointerException
    at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:280)
    at com.jme3.system.JmeSystem.newContext(JmeSystem.java:159)
    at com.jme3.app.LegacyApplication.createCanvas(LegacyApplication.java:510)
    at jme3test.awt.TestCanvas.createCanvas(TestCanvas.java:217)
    at jme3test.awt.TestCanvas.main(TestCanvas.java:248)

The same test app works fine with LWJGL2 on Windows.

I'm not sure what ever happened to jme3_lwjgl-ogl.

stephengold commented 5 years ago

Similar crash with LWJGL3 on Linux. How hard would it be to implement LwjglCanvas for LWJGL3?

tonihele commented 4 years ago

I guess it requires similar tactic than https://github.com/LWJGLX/lwjgl3-awt.

jseinturier commented 4 years ago

Hello.

I've submitted the PR #1150 to solve this problem but it is not accepted at this time.

The PR #1150 enables to render a Jmonkey scene within any AWT component and is independent from LWJGL version.

stephengold commented 4 years ago

@jseinturier Do you understand why 1150 hasn't been integrated yet?

stephengold commented 3 years ago

This issue is still present in JME v3.4.0-beta4.

stephengold commented 3 years ago

TestSafeCanvas also crashes, with a very similar stack trace:

May 14, 2021 10:23:49 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.4.0-SNAPSHOT
 * Branch: v3.4
 * Git Hash: 7b82356
 * Build Date: 2021-05-14
May 14, 2021 10:23:49 PM com.jme3.system.JmeDesktopSystem newContextLwjgl
SEVERE: CRITICAL ERROR: Context class is missing!
Make sure jme3_lwjgl-ogl is on the classpath.
java.lang.ClassNotFoundException: com.jme3.system.lwjgl.LwjglCanvas
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.jme3.system.JmeDesktopSystem.newContextLwjgl(JmeDesktopSystem.java:199)
    at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:275)
    at com.jme3.system.JmeSystem.newContext(JmeSystem.java:165)
    at com.jme3.app.LegacyApplication.createCanvas(LegacyApplication.java:542)
    at jme3test.awt.TestSafeCanvas.main(TestSafeCanvas.java:24)

Exception in thread "main" java.lang.NullPointerException
    at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:276)
    at com.jme3.system.JmeSystem.newContext(JmeSystem.java:165)
    at com.jme3.app.LegacyApplication.createCanvas(LegacyApplication.java:542)
    at jme3test.awt.TestSafeCanvas.main(TestSafeCanvas.java:24)
stephengold commented 2 years ago

Still an issue in "master" branch as of January 2022.

stephengold commented 2 years ago

Caused by the lack of a "com.jme3.system.lwjgl.LwjglCanvas" class in jme3-lwjgl3, obviously.

pavly-gerges commented 2 years ago

I will investigate into this.

dcr31000 commented 2 years ago

I'm beginning (and start learning) with jMonkeyEngine and got this issue. Do you have a workaround to start developing ? (Maybe use a previous version ? jme2 ?)

pavly-gerges commented 2 years ago

I'm beginning (and start learning) with jMonkeyEngine and got this issue. Do you have a workaround to start developing ? (Maybe use a previous version ? jme2 ?)

Just use lwjgl3 native window GLFW, or lwjgl-2 if you are using swing/AWT and want to utilize jme3 app within a swing application.

stephengold commented 2 years ago

I'm beginning (and start learning) with jMonkeyEngine and got this issue.

For support, I recommend joining the JMonkeyEngine forum and asking your questions there: https://hub.jmonkeyengine.org/

tonihele commented 1 year ago

I can try to fix this. I already created an awful working demo. I'll get it to somewhat nice shape. Try to get feature parity with the LWJGL 2 one and make a PR. Then at least it is implemented and can be improved upon later.

Pic or didn't happen: image

stephengold commented 1 year ago

Thanks @tonihele . This looks promising.