I'm thinking of using libGDX in eclipse, but when I ran the default class (badlogic image display), I got the following exceptions:
Exception in thread "LWJGL Application" java.lang.NullPointerException
at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.createDisplayPixelFormat
(LwjglGraphics.java:321)
at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setupDisplay(LwjglGraphics.java:215)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:142)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication $1.run(LwjglApplication.java:124)
In the top LwjglGraphics.java:321,
throw newGdxRuntimeException("OpenGL is not supported by the video driver:"+glVersion.getDebugVersionString(),ex3);
I think it is related to OpenGL, but I don't know the cause.
If anyone understands, I would appreciate it if you could tell me.
The operating system is Windows 10 64-bit, the eclipse is 4.6.0, and the Gradle is already plugged in.
https://stackoverflow.com/questions/38806017/libgdx-nullpointerexception-for-the-default-code
Here are some similar questions and answers.
Roughly translated,
Please add the line below to the game launch code.
System.setProperty("org.lwjgl.opengl.Display.allowSoftwareOpenGL", "true");
The boot code should look like this:
public class Main {
public static void main(String[]args) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
System.setProperty("org.lwjgl.opengl.Display.allowSoftwareOpenGL", "true");
config.title = "Mygame";
config.width = 1920;
config.height=1080;
new LwjglApplication (new MyGame(), config);
}
}
Also, update the graphics driver.
© 2024 OneMinuteCode. All rights reserved.