I've started to play with the libgdx runtime in Java.
But i can't seem to render without some sort triangular clipping.
I've based my code on the spine runtime examples:
public class AnimalTest extends ApplicationAdapter {
OrthographicCamera camera;
PolygonSpriteBatch batch;
SkeletonRenderer renderer;
TextureAtlas atlas;
Skeleton skeleton;
AnimationState state;
public void create () {
camera = new OrthographicCamera();
batch = new PolygonSpriteBatch();
renderer = new SkeletonRenderer();
atlas = new TextureAtlas(Gdx.files.internal("animals/Animals.atlas"));
SkeletonJson json = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("animals/Animals.json"));
skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
skeleton.setSkin("5");
skeleton.setX(1000);
skeleton.setY(-400);
AnimationStateData stateData = new AnimationStateData(skeletonData); // Defines mixing (crossfading) between animations.
state = new AnimationState(stateData); // Holds the animation state for a skeleton (current animation, time, etc).
state.setAnimation(0, "idle", true);
}
public void render () {
state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
state.apply(skeleton); // Poses skeleton using current animations. This sets the bones' local SRT.
skeleton.updateWorldTransform(); // Uses the bones' local SRT to compute their world SRT.
// Configure the camera, SpriteBatch, and SkeletonRendererDebug.
camera.update();
batch.setProjectionMatrix(camera.combined);
batch.begin();
renderer.draw(batch, skeleton); // Draw the skeleton images.
batch.end();
}
public void resize (int width, int height) {
camera.setToOrtho(false);
}
public void dispose () {
atlas.dispose();
}
}
Any suggestions how to solve this? Thank you!