I’m using LibGDX and the SpriteBatch and ShapeRenderer are having a perspective problem or something… When I draw something with both (code below), the planet texture is smaller than it should be. I can even manually set the size values and it’s still wrong.
I’m setting:
Matrix4 matrix = cam.combined;
batch.setProjectionMatrix(matrix);
sr.setProjectionMatrix(matrix);
and the draw code is…
// outline
sr.begin(ShapeRenderer.ShapeType.Filled);
sr.setColor(Color.BLACK);
sr.circle(c.getPos().x,c.getPos().y,c.getSize());
sr.end();
// planet tex
batch.begin();
batch.draw(c.getTexture(), c.getDrawPosition().x, c.getDrawPosition().y, c.getSize(), c.getSize());
batch.draw(c.getShadow(), c.getDrawPosition().x, c.getDrawPosition().y, c.getSize(), c.getSize());
batch.end();
Both the texture and the shape are centered properly and c.getSize() should always be returning the same value, so I’m trying to figure out why this isn’t working. I’ve tried manually setting the value for size and it still does it, so either the texture is being rendered at the wrong size or somehow the ShapeRenderer and SpriteBatch are using a different camera/projection.