I think this is a bug because it happens without any apparent logic.
In the game play part of my game, I have the game objects rendered in one world and the hud objects rendered in another world (so they would stay static while the rest of the game move). The game objects have transparency, while the hud objects don't.
On the first render frame, it renders the scene for both worlds and then draws the worlds (game then hud), but it's not displaying the fog on the game play's world objects. When I disable the rendering/ drawing of the hud world, the first render has the fog enabled.
With the hud world enabled and the scene incorrectly displaying, after touching the screen, the fog re-enables.
I tried using the framebuffer's clearZBufferOnly() before the hud's render/ draw line, but that didn't do anything. Then I played with some code which would render/ draw the worlds twice on only the first render frame, but that also did nothing. I also tried to disable the fog in the HUD's world (not sure how that would be helped)....but it also didn't do anything. Lastly, I disabled all the lighting in the HUD's world, both ambient light and any other lights added to the world, but the only thing that did was make the hud objects black.
= Gameplay code
boolean firstR = true;
public void Render(FrameBuffer fb)
{
/*
if(firstR)
{// attempted fix, which does nothing
world.renderScene(fb);
world.draw(fb);
fb.clearZBufferOnly();
hud.Render(fb);
}
*/
if((Touching || resetting) || firstR)
world.renderScene(fb);
firstR = false;
world.draw(fb);
//fb.clearZBufferOnly();
hud.Render(fb);
}
= HUD render code
private boolean render = true;
void Render(FrameBuffer fb)
{
if(render)
world.renderScene(fb);
render = false;
world.draw(fb);
}
Note: the renderScenes are linked to bool requirements so the worlds won't be needlessly rendering every frame (it made my phone hot and the fps slow).
The HUD currently only has 1 thing, which is the bottom left
= Pre-touch
= Post-touch (ignore the half-lighted/half-darked block, the picture was taken between render frames)