8

This is my set-up:

stage = new Stage(1280, 800, false);
button = new Button(drawableUp, drawableDown);
stage.add(button);

this gets rendered as following:

@Override
public void render(float delta) {

    Gdx.gl.glClearColor(RED,GREEN,BLUE,ALPHA);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.act(delta);

    stage.draw();
}

The issue is that when the stage is shown on 1280x800 the button looks like that:

unscaled image

If the stage is rescaled to e.g. 1280x736, the button drawable is scaled in the following way: scaled image

Is there a way to smooth out the edges somehow? Because right now it looks to me that the scaling is simply done by removing one pixel line in the upper half and one in the lower half of the picture.

1 Answers1

13

Are you using filters anywhere in your code? If not, then try this:

texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

Where texture is the texture object that you're using.

Anubian Noob
  • 13,426
  • 6
  • 53
  • 75
Pranav008
  • 1,225
  • 8
  • 11
  • 1
    Thanks. You have pointed me in the right direction. I have used: tex = new Texture(); tex.setFilter(TextureFilter.MipMapLinearLinear, TextureFilter.Linear); –  Apr 04 '13 at 14:33