Black stripes in LIBGDX

2019-08-04 05:40发布

I´m doing a mario bross game and I have problems i think with the rendering. I attached some photos to explain better the issue. I don´t have any idea why this happen.

Vertical stripes appear sometimes.

Thanks in advance.

@Override
public void render(float delta) {
    update(delta);
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    renderer.render();
    b2dr.render(world, gamecam.combined);
    game.batch.setProjectionMatrix(gamecam.combined);
    game.batch.begin();
    player.draw(game.batch);
    for (Enemigo enemigo:creator.getEnemies()) {
        enemigo.draw(game.batch);
    }
    for(Item item : items){
        item.draw(game.batch);
    }
    for (Plataforma plataforma : creator.getPlataformas()){
        plataforma.draw(game.batch);
    }
    game.batch.end();
    game.batch.setProjectionMatrix(hud.stage.getCamera().combined);
    hud.stage.draw();

    if(gameOver()){
        game.setScreen(new GameOverScreen(game));
        dispose();
    }
}

1条回答
贪生不怕死
2楼-- · 2019-08-04 06:11

imo, try the easy way first, do you use power of two (images used in tiled editor)? like 16px X 16px, 32px X 32px, 128px X 64px..etc

for eg. if you create new tiledmap with image 64px X 64px as tilewidth and tileheght, then you could set tile size WidthxHeight to 64px or 32px or 16px therefore the cell will be filled with your tile (texture bleeding wont appear)

查看更多
登录 后发表回答