LWJGL 报告现代 nvidia 卡不支持 OpenGL

LWJGL reports that OpenGL is not supported on a modern nvidia card

所以我在过去的一天里一直在尝试 libgdx 并且它运行良好,直到我意识到它只适用于我的带有英特尔图形的笔记本电脑,而它在我的带有 nvidia 750ti 的台式机上立即关闭.

根据this github issue, this issue should've already been fixed in this commit

我也尝试了其他人在旧 posts 上推荐的方法,比如 here and here(自从提交后不再需要,但值得一试)

System.setProperty("org.lwjgl.opengl.Display.allowSoftwareOpenGL", "true");

但信不信由你,这行不通。这是堆栈跟踪

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: OpenGL is not supported by the video driver.
    at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.createDisplayPixelFormat(LwjglGraphics.java:229)
    at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setupDisplay(LwjglGraphics.java:174)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:138)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.run(LwjglApplication.java:120)
Caused by: org.lwjgl.LWJGLException: X Error - disp: 0x7f0f4c000c50 serial: 194 error: BadValue (integer parameter out of range for operation) request_code: 154 minor_code: 24
    at org.lwjgl.opengl.LinuxDisplay.globalErrorHandler(LinuxDisplay.java:320)
    at org.lwjgl.opengl.LinuxContextImplementation.nCreate(Native Method)
    at org.lwjgl.opengl.LinuxContextImplementation.create(LinuxContextImplementation.java:51)
    at org.lwjgl.opengl.ContextGL.<init>(ContextGL.java:132)
    at org.lwjgl.opengl.Display.create(Display.java:850)
    at org.lwjgl.opengl.Display.create(Display.java:757)
    at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.createDisplayPixelFormat(LwjglGraphics.java:220)
    ... 3 more

将堆栈跟踪与 this guy 进行比较时,原因显然不是 Pixel format is not accelerated,而是 Caused by: org.lwjgl.LWJGLException: X Error - disp: 0x7f12cc000c50 serial: 194 error: BadValue (integer parameter out of range for operation) request_code: 154 minor_code: 24。 也许那只是因为我是 运行 linux 而他不是,我不知道。虽然 integer parameter out of range for operation 错误会是 LWJGL 认为我的视频驱动程序不支持 OpenGL 的原因,但这看起来确实很奇怪,但这只是一个猜测。

Here is the exact code that i'm trying to run。我不认为代码是罪魁祸首,因为它在我的笔记本电脑上运行良好,但为了以防万一,我将其添加到此处。

我的笔记本电脑和台式机都运行最新的 Arch Linux 安装,所以 os 应该不是问题。

提前致谢!

解决方法非常简单,感谢 P.T. 的帮助。

我不知道出了什么问题,但实际上根本没有 OpenGL 应用 运行,简单的重启就解决了我的问题。

Open Software & Updates

Additional Drivers

Using X.Org X server - Nouveau display drivers from xserver-xorg-video-mouveau (open source)

Apply Changes

Open terminal

sudo reboot now