Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.lwjgl.opengl.awt.AWTTest fails on XWayland #84

Open
wolfseifert opened this issue Jan 5, 2025 · 3 comments
Open

org.lwjgl.opengl.awt.AWTTest fails on XWayland #84

wolfseifert opened this issue Jan 5, 2025 · 3 comments

Comments

@wolfseifert
Copy link

org.lwjgl.opengl.awt.AWTTest fails at runtime on XWayland, it works on X11 and Windows. It used to work on XWayland for older versions (see attached build.gradle.kts).

Steps to reproduce:

$ gradle run
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes

> Task :run
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Failed to query GLX version
        at org.lwjgl.opengl.GL.createCapabilitiesGLX(GL.java:693)
        at org.lwjgl.opengl.GL.initCapabilitiesGLX(GL.java:326)
        at org.lwjgl.opengl.GL.getCapabilitiesGLXClient(GL.java:304)
        at org.lwjgl.opengl.GLX13.nglXChooseFBConfig(GLX13.java:131)
        at org.lwjgl.opengl.GLX13.glXChooseFBConfig(GLX13.java:154)
        at org.lwjgl.opengl.awt.PlatformLinuxGLCanvas.create(PlatformLinuxGLCanvas.java:65)
        at org.lwjgl.opengl.awt.PlatformLinuxGLCanvas.create(PlatformLinuxGLCanvas.java:121)
        at org.lwjgl.opengl.awt.AWTGLCanvas.beforeRender(AWTGLCanvas.java:79)
        at org.lwjgl.opengl.awt.AWTGLCanvas.render(AWTGLCanvas.java:120)
        at org.lwjgl.opengl.awt.AWTTest$2.run(AWTTest.java:59)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

The window shows up, but is empty.

@JNightRider
Copy link

Hi @wolfseifert

In version 3.3.4+ of lwjgl3 something curious happens, when it detects wayland it automatically loads EGL and not GLX (this is fine since waylandan is not compatible with GLX unless we use XWaylando as a bridge which is great), this configuration is active by default, but we can force lwjgl3 to use the X11 API as follows (a little trick).

Before any call to GL, you must configure which backend to use:

Configuration.OPENGL_CONTEXT_API.set("native");

@wolfseifert
Copy link
Author

Thanks, it works now on XWayland, X11 and Windows. Here is the updated test.zip.

I see this as a workaround, not a fix and therefore keep the issue open.

@JNightRider
Copy link

JNightRider commented Jan 13, 2025

There is a possible solution for this (I opened a PR to solve this problem without having to configure the backend manually).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants