Java 中没有上下文错误,但在 window 创建后立即设置了上下文

No context error in Java, but the context is set immediately after window creation

我正在尝试使用 LWJGL 3 制作游戏,但出现此错误:No context is current or a function that is not available in the current context was called.

此错误表示未调用这些方法:

glfwMakeContextCurrent(window);
GL.createCapabilities();

但是在我的代码中,这些在 window 创建后立即被调用:

...
this.window = glfwCreateWindow(this.width, this.height, this.title, 0, 0);
    if(this.window == NULL) {
      throw new RuntimeException("Failed to create window");
    }

        glfwMakeContextCurrent(this.window);
        GL.createCapabilities();
      
        ...

        this.world = new World(256, 256, 64); // calls GL11.glGenLists
        this.worldRenderer = new WorldRenderer(this.world);
        this.player = new Player(this.world);
...

这会引发前面提到的异常。我该如何解决?

GL11.glGenLists 已弃用。改为使用 GLFW_OPENGL_COMPAT_PROFILE