0
\$\begingroup\$

I've got a problem with libgdx.

First off, im working with libgdx and box2d on a little physics game.

Im using the aproach mentioned in this answer and thereby setting my camera to some smallish numbers and it worked out fine so far.

Now I've ran into following problem. When drawing my background (1920x1080) I am experiencing artifacts ingame and I am not sure where they are coming from.

I tried linear and nearest Filtering on the Texture with no differing results and I scale the image once via

beachSprite.setScale(camera.viewportWidth/Gdx.graphics.getWidth(), camera.viewportHeight/Gdx.graphics.getHeight());

This is what the background image looks when opening it With a regular image viewer: Image how it is supposed to look.

And this is what it looks like ingame: enter image description here

Oddly enough, there seem to appear no artifacts with smaller images, like the player character, or they are just too small to notice.

Thanks in advance for any help.

\$\endgroup\$
1
\$\begingroup\$

I was under the wrong impression that the default filter for libgdx is Linear Filtering, so I never actually tried setting it manually. Setting it for the texture solved it for me.

beachTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.