HUD problems - QUEUE_ORTHO and text colour

Hi - two more probably stupid questions:



My game has a HUD, which uses Quads which I have put in the Ortho queue with setRenderQueueMode(Renderer.QUEUE_ORTHO). Yet when the camera gets very close to a 3D object in the scene, the object is drawn over the HUD quad; I understood that QUEUE_ORTHO items were always drawn last, so they always appeared on top. Is my understanding not correct, or is there something else I need to do to get it to work? The twiki says "RenderQueue modes are inherited from a parent, so special care needs to be taken if a branch of the scene graph has different queue elements contained within it.  RenderQueue handles all processing and requires no work from the user. Sorting of the Geometry occurs dynamically as needed. The user must only set the RenderQueue mode. " I'm certainly trying to take special care, but is there something specific I need to be careful about?



Also, I have some text elements in the HUD - I am using the same texture state and alpha state used by fpsNode (I've extended SimpleGame); yet fpsNode text is white, and the text in my HUD is always dark grey. I've not done anything (knowingly) to change the colour. In fact, when I try to change the colour using Text.setTextColor(ColorRGBA color), nothing at all happens.  Again, is there something obvious I need to take special care about?

For your HUD, check that you are setting it always to pass the Z-Buffer check. As far as I can tell, the render queue will determine when it tries to render, but it will still be obscured by items closer in the z-buffer by default.

Trysomething like this:



ZBufferState zs = display.getRenderer().createZBufferState();
zs.setFunction(ZBufferState.CF_ALWAYS);
zs.setWritable(false);
hud.setRenderState(zs);



For your text, could be lighting? Try:


text.setLightCombineMode(LightState.OFF);
text.setTextColor(ColorRGBA.red);

Other things to check for:


  1. Check that the offending 3d object has a renderqueue mode that is not "SKIP".
  2. If you are using Passes, make sure the GUI is in it's own pass and drawn last.
  3. Make sure the Z coordinate of your UI quads is always 0.
  4. Check your camera's near planeā€¦  Make sure it is greater than 0.

Many thanks for the replies, ZBufferState.CF_ALWAYS and LightState.OFF fixed it.



Much appreciated!