LWJGL / lwjgl

[LEGACY] LWJGL 2.X - The Lightweight Java Game Library.
http://legacy.lwjgl.org/
546 stars 207 forks source link

LWJGL seems to be unable to handle connected but disabled outputs #129

Open Gymnasiast opened 8 years ago

Gymnasiast commented 8 years ago

I did a search on the bug tracker first, but could only find closed issues. Minecraft 1.8.9 seems to use LJWGJL 2.9.4 nightly, so I think this is a separate problem.

My situation is as follows: I play on a laptop with an external screen connected, and I have my internal screen disabled. The output of xrandr -q is as follows:

Screen 0: minimum 8 x 8, current 1920 x 1200, maximum 16384 x 16384
LVDS-1-0 connected
   1366x768      60.01 +
   1360x768      59.80    59.96  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   960x600       60.00  
   960x540       59.99  
   800x600       60.00    60.32    56.25  
   840x525       60.01    59.88  
   800x512       60.17  
   700x525       59.98  
   640x512       60.02  
   720x450       59.89  
   640x480       60.00    59.94  
   680x384       59.80    59.96  
   576x432       60.06  
   512x384       60.00  
   400x300       60.32    56.34  
   320x240       60.05  
VGA-1-0 disconnected
HDMI-1-0 connected primary 1920x1200+0+0 495mm x 309mm
   1920x1200     59.94*+
   1600x1200     60.00  
   1280x1024     60.02  
   1280x960      60.00  
   1024x768      60.00  
   800x600       60.32  
   640x480       60.00  
   720x400       70.08  
DisplayPort-1-0 disconnected

This seems to trip up LWJGL, as it causes a NullPointerException:

java.lang.ExceptionInInitializerError
    at ave.ar(SourceFile:560)
    at ave.am(SourceFile:361)
    at ave.a(SourceFile:310)
    at net.minecraft.client.main.Main.main(SourceFile:124)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
    at org.lwjgl.opengl.LinuxDisplay.getAvailableDisplayModes(LinuxDisplay.java:951)
    at org.lwjgl.opengl.LinuxDisplay.init(LinuxDisplay.java:738)
    at org.lwjgl.opengl.Display.<clinit>(Display.java:138)

I did a test where I hacked XRandR's output to show LVDS-1-0 is disconnected. When I do this, LWJGL works correctly. So it seems to be unable to handle LVDS-1-0 being connected but not enabled.

Environment: Ubuntu 15.10 AMD64 / 16.04 AMD64, Java 7, 8 and 9. x11-xserver-utils at version 7.7+5ubuntu1.

tfg13 commented 8 years ago

This has been fixed with 1dbca8b6236768793cf3c52702625ece7c3c3992 However, Minecraft seems to use an older nightly version from February 2015. There is newer build which does contain this fix. Maybe @grum can help?

Napoleon-x commented 3 months ago

I know this is a little old but if you are using MCP 1.8.9 or any other Minecraft version that uses legacy lwjgl, you can like cause it to launch on wayland/other resolutions by just downloading the xrandr package and then attempting to launch.

I still get an error but it launches :P

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:828)
    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:757)
    at net.minecraft.src.Config.checkDisplaySettings(Config.java:1895)
    at net.minecraft.src.Config.initDisplay(Config.java:163)
    at net.minecraft.client.renderer.OpenGlHelper.initializeTextures(OpenGlHelper.java:98)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:390)
    at net.minecraft.client.Minecraft.run(Minecraft.java:327)
    at net.minecraft.client.main.Main.main(Main.java:117)
    at Start.main(Start.java:11)