Closed stephengold closed 1 year ago
Hi, I did the test with the code but I do not have this problem. The program continues to function without getting stuck. I'm using JME 3.2
If you haven't already, try launching in full-screen mode and then pressing the "P" key.
After further investigation, it seems that the exception isn't raised unless the initial display mode has a color depth of 16 bits per pixel. If the initial mode has a color depth of 32 bits per pixel, the switch to windowed mode goes smoothly.
This problem may be related to your issue:
Well the os is useing 32bit for framebuffers in the window manager, maybe it is an invalid call to create a window with 16bit (and lwjgl will do just that)?
This does seem connected to issue #801. But in 801, there's no exception raised.
Need to re-test with both LWJGL v2 and v3.
Still seeing this issue with LWJGL v2 but not with v3.
With my improved understanding of LWJGL, I suspect this issue is fixable.
I'm still seeing this issue with JME 3.6.0-stable (LWJGL v2.9.5).
I can not reproduce this. Tried with 3.6.0-stable. Works fine for me with both lwjgl2 and lwjgl3.
Edit:
it seems that the exception isn't raised unless the initial display mode has a color depth of 16 bits per pixel.
In my case the only available color depth is 24 bpp when fullscreen is selected.
Edit2:
I noticed if I change
void goWindowed() {
settings.setFullscreen(false);
setSettings(settings);
restart();
}
to
void goWindowed() {
settings.setFullscreen(false);
settings.setDepthBits(32);
setSettings(settings);
restart();
}
I get this exception when switching from full-screen:
Mar 21, 2023 3:46:02 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.6.0-stable
* Branch: HEAD
* Git Hash: 53f2a49
* Build Date: 2023-03-20
Mar 21, 2023 3:46:02 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.5 context running on thread jME3 Main
* Graphics Adapter: null
* Driver Version: null
* Scaling Factor: 1
Mar 21, 2023 3:46:02 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
* Vendor: Intel Open Source Technology Center
* Renderer: Mesa DRI Intel(R) HD Graphics 3000 (SNB GT2)
* OpenGL Version: 3.3 (Core Profile) Mesa 20.0.8
* GLSL Version: 3.30
* Profile: Core
Mar 21, 2023 3:46:03 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer Information
* Device: OpenAL Soft
* Vendor: OpenAL Community
* Renderer: OpenAL Soft
* Version: 1.1 ALSOFT 1.15.1
* Supported channels: 64
* ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
* AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
Mar 21, 2023 3:46:03 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNING: Pausing audio device not supported.
Mar 21, 2023 3:46:03 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
Mar 21, 2023 3:46:03 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxiliary sends: 4
Mar 21, 2023 3:46:10 PM com.jme3.system.lwjgl.LwjglDisplay runLoop
SEVERE: Failed to set display settings!
org.lwjgl.LWJGLException: Could not choose GLX13 config
at org.lwjgl.opengl.LinuxDisplayPeerInfo.initDefaultPeerInfo(Native Method)
at org.lwjgl.opengl.LinuxDisplayPeerInfo.<init>(LinuxDisplayPeerInfo.java:61)
at org.lwjgl.opengl.LinuxDisplay.createPeerInfo(LinuxDisplay.java:827)
at org.lwjgl.opengl.DrawableGL.setPixelFormat(DrawableGL.java:61)
at org.lwjgl.opengl.Display.create(Display.java:846)
at org.lwjgl.opengl.Display.create(Display.java:797)
at com.jme3.system.lwjgl.LwjglDisplay.createContext(LwjglDisplay.java:161)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:206)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:242)
at java.base/java.lang.Thread.run(Thread.java:1589)
Mar 21, 2023 3:46:10 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[#33,jME3 Main,5,main]
java.lang.RuntimeException: No OpenGL context found in the current thread.
at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
at com.jme3.system.lwjgl.LwjglContext.initContext(LwjglContext.java:285)
at com.jme3.system.lwjgl.LwjglContext.reinitContext(LwjglContext.java:267)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:212)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:242)
at java.base/java.lang.Thread.run(Thread.java:1589)
and if I change it to
void goWindowed() {
settings.setFullscreen(false);
settings.setDepthBits(16);
setSettings(settings);
restart();
}
it shows a blank window after switching. (no spatial is rendered in the viewport)
Maybe changing color depth is not supported with context restart.
I made a commit to the master branch that may fix this issue, please re-test this from the master.
Feel free to reopen it if you still have the issue.
I reproduced the issue on Mint Linux using 3.6.0-stable. Then I ran the same test using jMonkeyEngine master branch at Git Hash 365759d and was unable to reproduce the issue. So I think it's solved.
Thank you, @Ali-RS!
If I start a JME application in windowed mode, I can switch to full-screen mode at any time, provided my settings match one of those supported by my graphic adapter.
However, if I start in full-screen mode, any attempt to switch to windowed mode crashes the application. I see this issue with both JME 3.1.0-stable and JME 3.2.0-stable
Here is my test app:
Here is typical output: