0

I am currently running into issues right now when I render my background image for my app. It has jagged edges in it as you can see:

https://i.stack.imgur.com/SrFgw.jpg

Now, here is the code which I am using to load the image in, and I have tried all possible combinations of the filtering so this is not the only one I have tried.

newPenguinGraphic = new Texture(Gdx.files.internal("data/1024Set1.png"),true);
    texture.setFilter(TextureFilter.MipMapLinearNearest, TextureFilter.Nearest);

Screen setup:

float gameWidth = 330;
    float gameHeight = screenHeight / (screenWidth / gameWidth);
    int midPointY = (int) (gameHeight / 2);

Cam:

cam = new OrthographicCamera();
    cam.setToOrtho(true, 330, gameHeight);

Graphic:

MainBackground = new BGScroller(0, yPos-165, 330, 220, SCROLL_SPEED, yPos);

The size of the original image is 688x459 also btw.

A question I have been wondering, do I need to generate the mipmap png files before and load them in manually or does libgdx literally create them at runtime? Please help, and thanks!!

Bellerofont
  • 1,081
  • 18
  • 17
  • 16
Michael
  • 83
  • 9
  • This doesn't quite look like a mip-mapping issue to me. Can you show your camera setup and how you're positioning, sizing, and drawing the texture, and what resolution your window/screen is? It looks to me like maybe the image is being magnified (mag filter) but pixel boundaries are lined up with screen pixels, so float rounding is causing blocks to fall on either side of the boundary when sampled. – Tenfour04 Sep 29 '16 at 15:36
  • It's funny you mention that about the window/screen resolution. I have been testing my app through a desktop launcher and that is where I took the screenshot of the image. Whenever I actually use an android emulator or my android phone, the same issues are not there however still not perfect. I have attached the requested information still. Please let me know if you see any glaring errors. Thanks – Michael Sep 30 '16 at 18:20
  • Try using Linear for the mag filter. And make your source image have an even height. – Tenfour04 Sep 30 '16 at 20:06

0 Answers0