question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

xrandr VSync issue

See original GitHub issue

Issue details

The issue is that when an xrandr mode that has an underscore in it’s name is selected as the resolution for the computer, libgdx breaks. To resolve the issue, I have to stay on 1024x768 to make it work.

libGDX crashes because there is an underscore in my xrandr name for 1080p resolution. Every resolution works except for “1280x720_60.00” and “1920x1080_60.00 59.96”

My xrandr -q out put is :

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384 VGA-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm 1024x768 60.00
800x600 60.32 56.25
848x480 60.00
640x480 59.94
1280x720_60.00 59.86
1920x1080_60.00 59.96* HDMI-1 disconnected (normal left inverted right x axis y axis) DP-1 disconnected (normal left inverted right x axis y axis) HDMI-2 disconnected (normal left inverted right x axis y axis) DP-2 disconnected (normal left inverted right x axis y axis) 1920x1080 (0x1bd) 173.000MHz -HSync +VSync h: width 1920 start 2048 end 2248 total 2576 skew 0 clock 67.16KHz v: height 1080 start 1083 end 1088 total 1120 clock 59.96Hz

Reproduction steps/code

Try running the desktop version of libGDX on ubuntu when your selected xrandr mode has an underscore in the name like “1920x1080_60.00 59.96*”

Version of LibGDX and/or relevant dependencies

gdxVersion = ‘1.10.0’

Stacktrace


BUILD SUCCESSFUL in 702ms
5 actionable tasks: 1 executed, 4 up-to-date
Exception in thread "LWJGL Application" java.lang.ExceptionInInitializerError
	at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setVSync(LwjglGraphics.java:643)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:125)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
	at org.lwjgl.opengl.XRandR.findPrimary(XRandR.java:326)
	at org.lwjgl.opengl.XRandR.ScreentoDisplayMode(XRandR.java:315)
	at org.lwjgl.opengl.LinuxDisplay$3.run(LinuxDisplay.java:746)
	at org.lwjgl.opengl.LinuxDisplay$3.run(LinuxDisplay.java:743)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.lwjgl.opengl.LinuxDisplay.init(LinuxDisplay.java:743)
	at org.lwjgl.opengl.Display.<clinit>(Display.java:138)
	... 2 more
AL lib: (EE) alc_cleanup: 1 device not closed
11:21:51 PM: Task execution finished 'DesktopLauncher.main()'.


Please select the affected platforms

  • Android
  • iOS
  • HTML/GWT
  • Windows
  • Linux
  • MacOS

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
crykncommented, May 14, 2021

Hey @JoshBot-Debug! That was to be expected, as the particle editor itself is using our LWJGL 2 backend. There are plans for migrating to LWJGL 3 (see #6247 in particular), so I think this issue here can be closed.

0reactions
JoshBot-Debugcommented, May 14, 2021

So, LibGDX works on my Linux now but I’m having the same problem with the particle editor. I downloaded the nightly build and ran the command : java -cp gdx.jar:gdx-natives.jar:gdx-backend-lwjgl.jar:gdx-backend-lwjgl-natives.jar:extensions/gdx-tools/gdx-tools.jar com.badlogic.gdx.tools.particleeditor.ParticleEditor

The error was the same vSync error. I tried : java -cp gdx.jar:gdx-natives.jar:gdx-backend-lwjgl3.jar:gdx-backend-lwjgl-natives.jar:extensions/gdx-tools/gdx-tools.jar com.badlogic.gdx.tools.particleeditor.ParticleEditor

and the error I got was : Exception in thread “AWT-EventQueue-0” java.lang.NoClassDefFoundError: com/badlogic/gdx/backends/lwjgl/LwjglCanvas

Read more comments on GitHub >

github_iconTop Results From Across the Web

xrandr scale with vsync - Ask Ubuntu
How do I get vsync working alongside the scale option using xrandr? I cannot seem to find any obvious fix from reading the...
Read more >
Xrandr - ArchWiki
xrandr is an official configuration utility to the RandR (Resize and Rotate) X Window System extension. It can be used to set the...
Read more >
How to Fix Screen Tearing on Linux - MakeUseOf
Simply open up the Settings of your compositor and look for an option labeled "VSync" or "Tearing Prevention Mode". Enable it and restart...
Read more >
xrandr does not correctly switch display refresh rates, but ...
The display is connected to eDP. See the attachment for a log of me running xrandr to show the current state, then switching...
Read more >
GLX vsync freezes after XRandR changes with Intel DDX driver
On mesa drivers, changing the screen resolution with XRandR results in a hang in the GLX VSync thread- particularly when the change makes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found