Repository: LWJGL/lwjgl3

Issue #880: LWJGL 3.3.2 There is no OpenGL context
Created: 2023-04-28T14:30:18Z
Version
3.3.2 (nightly)
Platform
Linux x64
JDK
OpenJDK 17.0.6
Module
OpenGL, GLFW
Bug description
Hi!
When I tried to create window using GLFW and call GL.createCapabilities to create capabilities, LWJGL throw exception with message There is no OpenGL context current in the current thread. This issue only occurs in LWJGL 3.3.2. When I used lwjgl3-awt library everything works. I also compiled latest GLFW and tested similar code, and it work, it can't be upstream issue.
My hardware:
GPU: Nvidia Quadro FX 880m
Driver: 340.108
I know this card is very old.
I also tested it on my old laptop with Intel GPU (also with Linux) and everything works.
Sample code giving me this error:
public static void main(String[] args) {
	if (!glfwInit())
	    System.err.println("Init error");

	GLFWErrorCallback.createPrint(System.err).set();

	glfwDefaultWindowHints();

	glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
	glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);

	long window = glfwCreateWindow(1280,720, "Sample Window!", NULL, NULL);
	if (window == NULL)
	    throw new RuntimeException("Failed to create the GLFW window");

	glfwMakeContextCurrent(window);

	GL.createCapabilities();

	glfwShowWindow(window);

	glfwSwapInterval(1);
	while (!glfwWindowShouldClose(window)) {
	    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	    glfwSwapBuffers(window);
	    glfwPollEvents();
	}

	glfwDestroyWindow(window);
}
Stacktrace or crash log output
Exception in thread "main" java.lang.IllegalStateException: There is no OpenGL context current in the current thread.
	at org.lwjgl.opengl.GL.createCapabilities(GL.java:382)
	at org.lwjgl.opengl.GL.createCapabilities(GL.java:311)
	at org.lwjgl.opengl.GL.createCapabilities(GL.java:295)
	at org.example.Main.main(Main.java:78)

Duplicate issue #955: "Extension string retrieval is broken" since 3.3.3 on Linux with intel iGPU
Created: 2023-12-29T10:54:53Z
Version
3.3.3, 3.3.2
Platform
Linux x64
JDK
Temurin or OpenJDK builds 11 - 21
Module
LWJGL Core
Bug description
This is unfortunately related in someway to libgdx, so I'm not sure where the issue is.
Is it a incorrect way libgdx calls lwjgl3 or something that got broken in lwjgl3.
I hava a libgdx basic demo app at https://github.com/krzyk/libgdx-test which works fine in libgdx 1.11.1 version which uses lwjgl3 3.3.1, but breaks when it upgrades to lwjgl3 3.3.2
First reported at libgdx/libgdx#7308 but the issue appeared only when changed dependency from lwjgl3 version 3.3.1 to 3.3.2.
My system is:
Linux (kernel 6.6.8)
Ubuntu 20.04 (but with custom video/mesa drivers)
libva info: VA-API version 1.21.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/local/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_21
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.21 (libva 2.6.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.4.3 (32841e3dc)

System has two GPUs (nvidia and intel one) but only intel one us used - nvidia doesn't have any drivers installed.
All OpenGL apps (like games, glxgears) work fine, the only issue is with lwjgl3 3.3.2 versions breaking on extensions string retrieval (like in the stacktrace).
Stacktrace or crash log output
[LWJGL] GLFW_PLATFORM_ERROR error
        Description : Extension string retrieval is broken
        Stacktrace  :
                org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2058)
                org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2229)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createGlfwWindow(Lwjgl3Application.java:527)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:463)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:449)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:163)
                com.mygdx.game.DesktopLauncher.main(DesktopLauncher.java:13)
[LWJGL] GLFW_PLATFORM_ERROR error
        Description : Extension string retrieval is broken
        Stacktrace  :
                org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2058)
                org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2229)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createGlfwWindow(Lwjgl3Application.java:527)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:463)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:449)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:163)
                com.mygdx.game.DesktopLauncher.main(DesktopLauncher.java:13)
[LWJGL] GLFW_PLATFORM_ERROR error
        Description : Extension string retrieval is broken
        Stacktrace  :
                org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2058)
                org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2229)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createGlfwWindow(Lwjgl3Application.java:527)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:463)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:449)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:163)
                com.mygdx.game.DesktopLauncher.main(DesktopLauncher.java:13)
Exception in thread "main" java.lang.NullPointerException
        at org.lwjgl.system.Checks.check(Checks.java:188)
        at org.lwjgl.system.MemoryUtil.memLengthNT1(MemoryUtil.java:2406)
        at org.lwjgl.system.MemoryUtil.memASCII(MemoryUtil.java:2673)
        at org.lwjgl.opengl.GL.createCapabilities(GL.java:442)
        at org.lwjgl.opengl.GL.createCapabilities(GL.java:311)
        at org.lwjgl.opengl.GL.createCapabilities(GL.java:295)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createGlfwWindow(Lwjgl3Application.java:572)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:463)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:449)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:449)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:163)
        at com.mygdx.game.DesktopLauncher.main(DesktopLauncher.java:13)

Closing comment (2023-12-29T12:16:27Z): Hey @krzyk,
Please check if Nvidia's libglvnd is present (and possibly broken/misconfigured) in your system. The issue might be related to #880. To verify, try running the application with -Dorg.lwjgl.opengl.libname=libGL.so.1 and calling GLFWNativeGLX.setPath(GL.getFunctionProvider()) before initializing GLFW.