Robert,
Actually I don't touch the state set in my subclass, I just apply a new
state set from outside. So I don't see why using a subclass should
matter in this case. However, I decided to use getOrCreateStateSet and
just work in the Text's existing state set. This way it works fine.
By the way, I discovered that I have the same problems with overriding
polygon mode to fill, causing the text to disappear if a state set above
is switched to wireframe. Just a proof of that it is a general state set
problem and not specific to depth test. Anyway, I get around both the
problems by modifying the existing state set instead of creating one of
my own.
/Andreas
Robert Osfield wrote:
Hi Andreas,
osgText::Text does some non standard management osg the attached
StateSet to cover cases where no StateSet is manually attached, this
is done to help state sorting and the approrpriate default binning of
osgText::Text. For 1.2 this behavior changed a bit, making it more
flexible in fact, such that you can now set your own StateSet where
previously it forcably used StateSet's managed by Font.
I suspect in your subclass you are playing around a bit with the
StateSet in a way that osgText::Text hasn't kept track off. You could
either tweak you subclass to play better with the mechanism in
osgText::Text, or just attach a StateSet to the Geode above the Text
drawable.
Robert.
On 10/3/06, *Andreas Ekstrand* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Robert,
> Well spotted, I added a ClusterCullingCallback to the text so the it
> disappears when it goes round the other side of the earth. Without
> this the example looks really odd.
Ok, with the ClusterCullingCallback turned off everything looks as I
expected it to.
In my own code I have discovered that everything works fine if I use
getOrCreateStateSet on the Text object to turn off depth test. If I
create my own state set with depth test turned off and apply that
state
set to my Text, it doesn't work. Even if I first apply my own
state set
to the Text object and then use getOrCreateStateSet it doesn't
work. So
it seems like I'm replacing an existing state set with one that
doesn't
do the job properly. Is it generally a bad idea to replace the
state set
directly on an osgText::Text? In your example your state set is on the
group above.
Actually I'm using a class of my own, inheriting from
osgText::Text. If
I use osgText::Text directly it seems to work. So it's probably
something fishy with this inheritance, even if my own class is very
simplistic, only overriding the constructor and copy-constructor, both
calling osgText::Text(). Anyway, I can always use the
getOrCreateStateSet approach, even if it seems unnecessary. But I do
wonder why this is, seems too basic to be a bug somewhere in osg...
> You cannot see what is not there? Get some sleep!! ;-)
Yeah, sounds serious, doesn't it? :-) Off to get some shut-eye
right now...
/Andreas
--
________________________________________________________________________
Andreas Ekstrand
Remograph
Rekrytgatan 10
SE-582 14 Linköping
SWEDEN
Website: http://www.remograph.com
E-mail: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
_______________________________________________
osg-users mailing list
[email protected] <mailto:[email protected]>
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/ <http://www.openscenegraph.org/>
------------------------------------------------------------------------
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
--
________________________________________________________________________
Andreas Ekstrand
Remograph
Rekrytgatan 10
SE-582 14 Linköping
SWEDEN
Website: http://www.remograph.com
E-mail: [EMAIL PROTECTED]
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/