i’ve been struggling with adding shader on the world map. Since i would like to have day and night cycle in the world and i stumble across shaders.
Problem i got is that shaders is only being applied to the player and not the world map. Also strange enough the ground under the player become black aswell. I used this tutorial: http://www.gamefromscratch.com/post/2014/07/08/LibGDX-Tutorial-Part-12-Using-GLSL-Shaders-and-creating-a-Mesh.aspx Used first example for simple approch.
public void render(float deltaTime) {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
game.batch.setProjectionMatrix(camera.combined);
camera.position.set(player.getPosition().x, player.getPosition().y, 0);
camera.update();
game.batch.setShader(shader);
mapRenderer.setView(camera);
mapRenderer.render();
game.batch.flush();
game.batch.begin();
game.batch.draw(player.getTexture(), player.getPosition().x, player.getPosition().y, 32 / game.UNIT_SCALE, 32 / game.UNIT_SCALE);
game.batch.end();
}