Hi Juan,

osgText::Text is a special case in that the way the text is rendered
is using textures and to for best performance and memory usage you
need to share these textures, and also share the rest of the text
state as well.

If you want to decorate the Text with your custom StateSet than it's
best to place it on a Geode above the Text object.

Robert.

On 4 January 2012 17:31, Juan Hernando <[email protected]> wrote:
> Dear all,
> Trying to use different StateSet with different osgText::Text objects it
> happens that all text objects transparently may share the same StateSet
> depending on how the state sets are created.
> Image that we have two text objects t1 and t2, then the following calling
> sequences behave as follows:
>
> Case 1
>  t1->getOrCreateStateSet()
>  // t2 with the default empty state set
> t1 will have a new StateSet and t2 will inherit it from its parent.
>
> Case 2
>  t1->getOrCreateStateSet()
>  t2->getOrCreateStateSet()
> Both texts will use the same state
>
> Case 3
>  t1->setStateSet(a_state)
>  t2->getOrCreateStateSet()
> Each object will have its own state.
>
> Case 4
>  t1->getOrCreateStateSet()
>  t2->setStateSet(a_state)
> Each object will have its own state.
>
> Case 5
>  t1 // created first no stateset assigned
>  t2->getOrCreateStateSet()
> Both texts will use the same state
>
> While it may make sense, it seems a bit weird to me.
> If this is the expected behaviour I couldn't find where does it say so in
> the reference. Is it actually supposed to work like that and what is the
> reason behind it?
>
> Thanks and regards,
> Juan
>
> PS I attach a simple program in case someone wants to verify my statements.
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to