Let's get some code:
public MyScreen implements Screen{
logo = new Texture(/**/); // loading some images
// initializing the RayHandler
rayHandler = new RayHandler(new World(new Vector2(0f,0f), false));
rayHandler.setShadows(false);
rayHandler.setCombinedMatrix(stage.getCamera().combined);
}
@Override
public void render(float delta) {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
Gdx.gl.glClearColor(Color.WHITE.r,Color.WHITE.g,Color.WHITE.b,1);
batch.begin();
batch.draw(logo,logo_pos.x, logo_pos.y, logo.getWidth(),logo.getHeight());
batch.end();
stage.act(delta);
stage.draw();
rayHandler.updateAndRender();
}
When I worked with LibGDX before, I used the same code above but with a background texture. Everything was fine when I disabled shadows.
Now I don't want to use a texture, but a single color (white, as shown above). The problem is here, that the background is BLACK, but! my logo texture is visible.
Somehow rayHandler is applying the black background and I don't know if I'm doing something wrong or I just can't combine Box2dLights with a background color. Should I use a background texture with my desired color and set it as a background, or is there a solution for this?
Change the order of the two calls, glClearColor
and glClear
, as follows:
Gdx.gl.glClearColor(Color.WHITE.r, Color.WHITE.g, Color.WHITE.b, 1f); // White
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
In your code, the screen is cleared before the colour is set...