Hi,
I'm doing a isometric type game. For each character i have 41 different poses with corresponding animations. This means 41 different json spine files. What Im trying to achieve is to take setup pose for each of 41 poses and make a texture atlas. When exporting from spine I scale everything to 0.3f.
Im trying to use FBO to render the texture.
final static int widthConst = 64;
final static int heightConst = 128;
final static int FBOwidthConst = 2048;
final static int FBOheightConst = 2048;
...
YieldingFrameBuffer fbo = new YieldingFrameBuffer(Pixmap.Format.RGBA8888, FBOwidthConst, FBOheightConst, false);
//fbo.getColorBufferTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
fbo.begin();
skeletonRenderer.setPremultipliedAlpha(true);
batch.getProjectionMatrix().setToOrtho2D(0, 0, fbo.getWidth(), fbo.getHeight());
Gdx.gl20.glClearColor(0f, 0f, 0f, 0);
Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);
Gdx.gl20.glEnable(GL20.GL_TEXTURE_2D);
batch.begin();
int fitInRow = fbo.getWidth() / widthConst;
int currIdx = 0;
for (int j = 0; j < charactersNeeded.length; j++)
{
IntMap<TextureSkeletonHolder> map = _dictOfTextureAtlas.get(charactersNeeded[j]);
IntArray arr = map.keys().toArray();
arr.sort();
for (int idx : arr.items)
{
TextureSkeletonHolder holder = map.get(idx);
for (Texture tex : holder.TextureAtlas.getTextures())
tex.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
Skeleton skeleton = new Skeleton(holder.SkeletonData);
AnimationStateData animationState = new AnimationStateData(holder.SkeletonData);
AnimationState animstat = new AnimationState(animationState);
int currentIndex = currIdx++;
int multipyBy = currentIndex / fitInRow;
int y = multipyBy * heightConst;
y = (heightConst) + y;
int x = currentIndex * widthConst - (multipyBy * fitInRow * widthConst);
skeleton.setPosition(x, y);
skeleton.setFlipY(true);
animstat.apply(skeleton);
skeleton.updateWorldTransform();
skeleton.setToSetupPose();
skeletonRenderer.draw(batch, skeleton);
skeleton.setFlipY(false);
}
}
batch.end();
fbo.end();
TextureRegion testTexture = new TextureRegion(fbo.disposeAndTakeColorTexture());
testTexture.getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
testTexture.flip(false, true);
However the rendered images don't seem reneged like they should. For example, it seems that they are little bit stretched. I played with filters, but I got blurry images if I don't set (Nearest, Nearest) in spine texture.
Here is the example, notice a slight streching.
Loading Image
Any idea what I'm doing wrong?