Aloento

I'm doing a program to test Spine_LibGDX and I get this error:
Exception in thread "LWJGL Application" java.lang.NullPointerException: Cannot invoke "com.badlogic.gdx.utils.Array.contains(Object, boolean)" because "com.badlogic.gdx.backends.lwjgl.LwjglGraphics.extensions" is null
at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.supportsExtension(LwjglGraphics.java:622)
at com.badlogic.gdx.graphics.GLTexture.getMaxAnisotropicFilterLevel(GLTexture.java:232)
at com.badlogic.gdx.graphics.GLTexture.unsafeSetAnisotropicFilter(GLTexture.java:191)
at com.badlogic.gdx.graphics.Texture.load(Texture.java:163)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:147)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:142)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:122)
at com.badlogic.gdx.graphics.g2d.TextureAtlas.load(TextureAtlas.java:253)
at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:245)
at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:240)
at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:235)
at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:225)
at com.QYun.SpineTest.create(SpineTest.java:30)
It is SpineTest code:
public class SpineTest implements ApplicationListener {

float x = 0;
float y = 0;
OrthographicCamera camera;
TwoColorPolygonBatch batch;
SkeletonRenderer renderer;
Skeleton Frostl_Build;
AnimationState Frostl_BuildState;

@Override
public void create() {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera(w, h);
batch = new TwoColorPolygonBatch();
renderer = new SkeletonRenderer();
renderer.setPremultipliedAlpha(true);

TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("Frostl_Build/Frostl_Build.atlas"));
SkeletonBinary binary = new SkeletonBinary(atlas);
binary.setScale(4.0f);
SkeletonData skeletonData = binary.readSkeletonData(Gdx.files.internal("Frostl_Build/Frostl_Build.skel"));
Frostl_Build = new Skeleton(skeletonData);
Frostl_Build.setPosition(300, 50);

AnimationStateData stateData = new AnimationStateData(skeletonData);
Frostl_BuildState = new AnimationState(stateData);
Frostl_BuildState.addAnimation(0, "run", true, 0);
}

@Override
public void resize(int width, int height) {
if(camera != null) camera.setToOrtho(false, width, height);
x = camera.position.x;
y = camera.position.y;
}

@Override
public void render() {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

Frostl_BuildState.update(Gdx.graphics.getDeltaTime());
Frostl_BuildState.apply(Frostl_Build);
Frostl_Build.updateWorldTransform();

camera.update();
camera.update();
batch.getProjectionMatrix().set(camera.combined);
batch.begin();
renderer.draw(batch, Frostl_Build);
batch.end();

Gdx.graphics.setTitle("Fps: "+ Gdx.graphics.getFramesPerSecond());
}

@Override
public void pause() {
}

@Override
public void resume() {
}

@Override
public void dispose() {

}
}
Please help me BadLogic :(
Aloento
  • 記事: 25

Nate

This looks like a libgdx problem. The call to contains is line 651 in the latest libgdx:
https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/lwjgl/LwjglGraphics.java#L651
Please try running the latest nightly or snapshot libgdx build. To use the latest snapshot set gdxVersion in your build.gradle file, for example to 1.9.13-SNAPSHOT.
アバター
Nate

Nate
  • 記事: 11795

Aloento

Ok, I think it's my fault. Now I'm working on a project which is suitable for the older libgdx version and now I have to upgrade it

https://github.com/soarteam/LibGDFX/blob/77661f0c7c1a23578f62b9ac66879bdd7e66985a/src/main/java/com/badlogic/gdx/backends/lwjgl/LwjglFXApplication.java#L50.

I think there is a source of the problem. I'm not sure, could you help me? :(

---

OK, I override all of them, and it works well.
supportsExtension, extractVersion, extractExtensions
Aloento
  • 記事: 25


Return to Runtimes