Black stripes in LIBGDX

我是研究僧i 提交于 2019-12-11 06:01:29

问题


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:


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)



来源:https://stackoverflow.com/questions/53207557/black-stripes-in-libgdx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!