I've been working on this problem for a while now. My problem is that the sphere in the top image, is under-lapping the plane which should have a lower Z value. Although, when depth testing is disabled, it is resolved. But it favors draw order over actual fragment depth value. I was changing the depth mask out of desperation. ;)
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
rootObject.render(ambient);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
GL11.glDepthMask(false);
GL11.glDepthFunc(GL11.GL_EQUAL);
for(int i = 0; i < lights.size(); i++){
lights.get(i).use();
rootObject.render(lights.get(i).getProgram());
}
GL11.glDepthFunc(GL11.GL_LESS);
GL11.glDepthMask(true);
-- Screenies:
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask
? – Krom Stern Nov 24 '14 at 6:00