Im building a game for android.
The current resolution is 800x600
Some sprites when moving on the screen, are tearing…
So i went to my TPacker and did this :
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.duplicatePadding = false;
settings.edgePadding = true;
settings.fast = false;
settings.filterMag = Texture.TextureFilter.Nearest;
settings.filterMin = Texture.TextureFilter.Nearest;
Then i went to my Box2D Body and did this :
sprite.getTexture().setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
It helped a bit. But it still happens.
I also did this :
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.width = 800;
config.height = 600;
config.allowSoftwareMode = true;
config.vSyncEnabled = true;
config.fullscreen = true;
And it seems to be more noticable on big Sprites.
So my questions are :
A) Are my settings properly good? Mipmaps cause the sprites to not render… might be because im mixing with box2d
B)If i increase the “width” float variable in this piece of code, it gets mmore noticeable, therefore, could it be a problem with the png itself? Do i need to somehow increase the quality of the image?
//Box2DSprite from dermetfan lib
sprite.getTexture().setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
BodyEditorLoader loader = new BodyEditorLoader(Gdx.files.internal("giantAsteroids/" + asteroidFile));
// 1. Create a BodyDef, as usual.
BodyDef bd = new BodyDef();
bd.position.set(x, y);
bd.type = BodyType.DynamicBody;
// 2. Create a FixtureDef, as usual.
FixtureDef fd = new FixtureDef();
fd.density = 30f;
fd.friction = 2f;
fd.restitution = 0.15f;
fd.filter.categoryBits = CollisionLogic.getCATEGORY_GAME_OBJECTS();
fd.filter.maskBits = CollisionLogic.getMASK_GAME_OBJECTS();
// 3. Create a Body, as usual.
body = world.createBody(bd);
float width = 10;
// 4. Create the body fixture automatically by using the loader.
loader.attachFixture(body, "asteroid.png", fd, width);
body.setUserData(this);
return body;
}
C) What else can i look for?
And thanks!
Happy new year!