Hi,
This may be a opengl filter issue maybe? But here's my problem.
I have a rotation set and it looks fine running in spine, no distortion at all.
However, when I take it into the demo example in libgdx for the spine runtime, it distorts like this:
json
{"bones":[{"name":"root"},{"name":"bone1","parent":"root","x":-0.54,"y":0.1},{"name":"bone2","parent":"bone1","length":27.95}],"slots":[{"name":"root","bone":"root"},{"name":"bone2","bone":"bone2","attachment":"dummy"}],"skins":{"default":{"bone2":{"dummy":{"x":0.54,"y":-0.1,"width":32,"height":32}}}},"animations":{"walk":{"bones":{"bone2":{"rotate":[{"time":0,"angle":355},{"time":0.5,"angle":0},{"time":1,"angle":5},{"time":1.5,"angle":0},{"time":2,"angle":355}]}}}}}
atlas
dummy.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
dummy
rotate: false
xy: 1, 1
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
I'm using the sample, just slightly modified.
package com.esotericsoftware.spine;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
public class AnimationStateTest extends ApplicationAdapter {
SpriteBatch batch;
ShapeRenderer renderer;
float time;
TextureAtlas atlas;
Skeleton skeleton;
Bone root;
Animation animation;
public void create () {
batch = new SpriteBatch();
renderer = new ShapeRenderer();
atlas = new TextureAtlas(Gdx.files.internal("res2/dummy.atlas"));
SkeletonJson json = new SkeletonJson(atlas);
SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("res2/dummy.json"));
// Define mixing between animations.
//AnimationStateData stateData = new AnimationStateData(skeletonData);
//stateData.setMix("walk", "walk", 0.4f);
//stateData.setMix("jump", "walk", 0.4f);
skeleton = new Skeleton(skeletonData);
animation = skeletonData.findAnimation("walk");
root = skeleton.getRootBone();
root.setX(250);
root.setY(20);
skeleton.updateWorldTransform();
}
public void render () {
time += Gdx.graphics.getDeltaTime();
animation.apply(skeleton, time, true);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
batch.begin();
// if (state.getAnimation().getName().equals("walk")) {
// // After one second, change the current animation. Mixing is done by AnimationState for you.
// //if (state.getTime() > 2) state.setAnimation("jump", false);
// } else {
// if (state.getTime() > 1) state.setAnimation("walk", true);
// }
skeleton.updateWorldTransform();
skeleton.draw(batch);
batch.end();
}
public void resize (int width, int height) {
batch.getProjectionMatrix().setToOrtho2D(0, 0, width, height);
renderer.setProjectionMatrix(batch.getProjectionMatrix());
}
public void dispose () {
atlas.dispose();
}
public static void main (String[] args) throws Exception {
new LwjglApplication(new AnimationStateTest());
}
}