<TextureRenderer|User's Guide|Fundamental Shapes>
See Javadoc
The render queue provides the means to organize scene elements prior to drawing them. In simple scenes, this is not required and can be ignored. However, it doesn't take long before proper Geometry sorting is required to prevent any rendering artifacts. For example, by default Geometry is rendered by its position in the Scene Graph. If there are transparent objects in the graph, and they are drawn before any opaque objects that are supposed to be behind it, those objects will not appear visible through the transparent object. This is where RenderQueue comes into play. RenderQueue makes use of a number of different buckets: opaque, transparent and ortho. Renderer defines the constants and to set a queue you use the method setRenderQueueMode in Spatial. For example, to place some Geometry into the transparent queue:
geom.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);
Once objects are in the queues, they are preprocessed and ordered before being drawn. The ordering is as follows:
The order is important for the following reasons:
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.