Overlay.setDepth() not working

Started by oxi, September 10, 2012, 09:41:25 PM

Previous topic - Next topic

oxi

My HUD consists of three parts. Every part is an Overlay-Object
A Background, called "hud_camera", a slider "hud_camera_slider" and a circle "hud_camera_circle"
I want the slider and the circle displayed ontop of the background. But the setDepth() function seems to do nothing.

Only the order of declaration changes the displayed order.
It works if I declare the Overlays in this order:
hud_camera_circle
hud_camera
hud_camera_slider

Any other order will give the wrong result.

But when I move the camera around the circle flickers. (sometimes behind background, sometimes before)

Can I use .setDepth() everywhere or just in a special place, like right after the declaration, in the onDrawFrame(), ...?
Is setDepth(1.0f) in front of setDepth(2.0f) ?
Or should I use Config.nearPlane+1 and Config.nearPlane+2 ?

EgonOlsen

 Order goes from lower to higher values with lower values being in front of higher ones. At least that's how it should work. You should be able to change depth at runtime, but if that doesn't work, try it right after creating the overlay. If that doesn't help either, consider using Framebuffer.blit() instead.