Harold Comere wrote:
Hi all,
Does the depth test has an effect over osg::Text ?
I have disabled the depth test on a node with/
setMode ( GL_DEPTH_TEST, osg::StateAttribute::OFF );/
In my understanding with depth test disabled, the last thing drawed
will be over all other.
But i want to draw 2D labels constitued by an osg::Text over a
background textured quad.
So if i add childs to the node with disabled depth test in following
order :
label1Background , label1Text, label2Background, label2Text
i should obtain the label2 over the label1 ... it is ok for
backgrounds, but any osg::Text go always over every background quads.
Is there any reason to this behavior ?
Yes. To help with performance, OSG will default to sorting Drawables by
state, so you have no guarantee that one object will always be drawn
before another object.
You can use RenderBins to change this behavior. For example you can
call setRenderingHint(osg::StateSet::DEPTH_SORTED_BIN) on the node's
StateSet. This will cause all Drawables under that node to be drawn
after all the other Drawables and also to be sorted by depth instead of
by state. The sort is done based on the center of the Drawable's
bounding volume.
You can also use setRenderBinDetails() to get finer control over the
binning process. This lets you use any number of bins to guarantee that
some objects are drawn after others. In general, the lower the bin
number, the earlier it's drawn.
--"J"
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org