Author Topic: Overlay.setDepth() not working  (Read 883 times)

Offline oxi

  • byte
  • *
  • Posts: 1
    • View Profile
Overlay.setDepth() not working
« on: September 10, 2012, 09:41:25 pm »
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:

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 ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12048
    • View Profile
Re: Overlay.setDepth() not working
« Reply #1 on: September 11, 2012, 01:52:23 pm »
 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.