Can someone please help me resolve this issue. I've tried searching myself and the common answer suggested is to use a TextureFilter. I've tried doing that multiple times but nothing works. My png resolution is 1024x1024, and I'm trying to shrink it's size to fit on screen. This is the kind of result I'm getting, you can see that the circle looks very pixelated, despite the actual image having anti-aliased edges.
Here's the code:
SpriteBatch batch;
Texture img;
Sprite sprite;
@Override
public void create () {
batch = new SpriteBatch();
img = new Texture("circle.png");
img.setFilter(TextureFilter.Linear, TextureFilter.Linear);
sprite = new Sprite();
sprite.setRegion(img);
}
@Override
public void render () {
Gdx.gl.glClearColor(0,0,0,0);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(img, 0, 0, 128, 128); //draw texture -- reduced size
batch.draw(sprite, 200, 200, 128, 128); //draw sprite -- reduced size
batch.draw(img, 250, 250); //draw texture -- original size
batch.end();
}