Android Question box2d libgdx - Texture Bleeding

coldteam

Active Member
Licensed User
Longtime User
Hi
Im using 64x64 tiles on map.
when the camera moves, gaps between tiles!
i read about this, it is called Texture bleeding

how it fix it?

i move camera like this:
B4X:
    Dim lerp As Float = 1.5f
    CAMERA.Position.set(CAMERA.Position.x + (PLAYER_BODY.Position.x - CAMERA.Position.x) * lerp * GD.Graphics.DeltaTime,CAMERA.Position.y + (PLAYER_BODY.Position.y - CAMERA.Position.y) * lerp * GD.Graphics.DeltaTime,0)
 

Informatix

Expert
Licensed User
Longtime User
You could use TiledMapPacker as suggested by the Maps section in the libGDX introduction. But if that only happens when you move the camera, the reason behind may also be a rounding problem of the coordinates. All coordinates once converted to screen coordinates should give integers.
 
Last edited:
Upvote 0

coldteam

Active Member
Licensed User
Longtime User
Ye,Tnx. yesterday i try set camera with int,
B4X:
Dim x,y as int
CAMERA.Position.set(x,y,0)

the camera is shaking but texture bleeding

try gdx-texturepacker with Duplicate Padding
and than load to Tiled Map Editor

the problem did not disappear

Could there be a reason, i use:
B4X:
Dim Batch As lgSpriteBatch
. .  and . .
Dim Renderer As lgMapOrthogonalTiledMapRenderer

in LG_RENDER()
Batch.Begin
... render background
Batch.End
Renderer.Begin
.... render layers
Renderer.End
Batch.Begin
... render more
Batch.End

is it normal?

(i draw textures in Pyxel Edit and photoshop)
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Is there a strong reason to have two different Spritebatch objects?
Is the performance disappointing on old devices ?
 
Upvote 0

coldteam

Active Member
Licensed User
Longtime User
i use
Dim Batch As lgSpriteBatch
for draw BitmapFonts and Static textures

B4X:
Camera.Initialize2( Scale * 4, Scale * 4 * Height / Width)
CameraFont.Initialize2(GD.Graphics.Width,GD.Graphics.Height)

in render
B4X:
Camera.Update
Renderer.SetCameraView(Camera)
....
CameraFont.Update
Batch.ProjectionMatrix = CameraFont.Combined
 
Upvote 0

coldteam

Active Member
Licensed User
Longtime User
about TiledMapPacker
is it work now ?
in extensions no gdx-tiled-preprocessor
i use script:
java -cp gdx.jar; gdx-natives.jar; gdx-backend-lwjgl.jar; gdx-backend-lwjgl-natives.jar; extensions \ gdx-tools \ gdx-tools. jar; extensions \ gdx-tiled-preprocessor \ gdx-tiled-preprocessor.jar com.badlogic.gdx.tiledmappacker.TiledMapPacker

1) G:\TR\IN G:\TR\OUT
2)\TR\IN \TR\OUT
3)/TR/IN /TR/OUT

Nothing happens
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
A common case is a Spritebatch for Box2D objects (with a metric coordinate system) and a Spritebatch for background and HUD, so your current use is perfectly OK from my point of view.
For performance, it's better to avoid abusing of Spritebatch instances but 2 is not a problem at all.
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Maybe, they removed it or it exists a new tool with a different name. Don't know.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…