--- This guide is now available on libgdx.com. Check it out here. If you have any questions, join us on Discord! ---
- To switch to libGDX's LWJGL 3 backend, open your root
build.gradle
file and replace the LWJGL backend dependency:
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
with the LWJGL 3 backend dependency:
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
Make sure to refresh your Gradle dependencies in your IDE.
- Next, you need to fix up your
DesktopLauncher
class. It is located in your desktop project and should look something like this:
public class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
new LwjglApplication(new MyGdxGame(), config);
}
}
You’ll need to change it to this:
public class DesktopLauncher {
public static void main (String[] arg) {
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
new Lwjgl3Application(new MyGdxGame(), config);
}
}
- On macOS, the LWJGL 3 backend is only working when the JVM is run with the
-XstartOnFirstThread
argument. This can typically be done in the Launch/Run Configurations of your IDE. Further information can be found here. - If you are using gdx-tools and the lwjgl3 backend in the same project, you need to modify your gdx-tools dependency like this:
The cause of this is described here.compile ("com.badlogicgames.gdx:gdx-tools:$gdxVersion") { exclude group: 'com.badlogicgames.gdx', module: 'gdx-backend-lwjgl' }
Running Android Studio v4.0.1 on Win 10 64 bit machine.
What does it mean to "Make sure to refresh your Gradle dependencies in your IDE."
I made the 2 changes above to my build.gradle and DesktopLauncher.
I invalidated caches and restarted, cleaned and rebuilt project.
I get this error and others when trying to launch desktop.
"Could not find lwjgl-glfw-3.2.3-natives-sindows-x86.jar (org.lwjgl:lwjgl-glfw:3.2.3)"