Hi Terry,

The code is not ideal, but it does try to provide a bit of fallback
for when one can't establish the actual bounding volume of a text item
because it's scaling is dependent upon the current modelview matrix -
something that it won't know until after the first frame.  The problem
boils down to what size of bounding box is appropriate if you don't
know what scale to use.  A zero scaling assumed is no more or no less
valid than any other size, but it does mean that at least it won't be
too large.

I can see problems with the current implementation when small feature
culling are on, and when the origin of the label is outside the view
frustum but the label when eventually scaled correctly would inside
the view frustum.  Is it one of these two cases that you hitting
problems with?

As to a robust solution that works in all cases, well it's a bit
akward - you almost need to disable culling for the first frame for
these Text drawables, then re-enable culling once they have a size.

Robert.

On Wed, Jun 22, 2011 at 10:35 PM, Terry Welsh <[email protected]> wrote:
> Hi,
> I found another problem with invisible text today.  In TextBase.cpp
> there is this chunk of code at line 290:
>
>            // provide a fallback in cases where no bounding box has
> been been setup so far
>            if (_characterSizeMode!=OBJECT_COORDS || _autoRotateToScreen)
>            {
>                // default to a zero size.
>                bbox.set(_position, _position);
>            }
>            else
>            {
>                osg::Matrix matrix;
>                matrix.makeTranslate(_position);
>                matrix.preMultRotate(_rotation);
>
> bbox.expandBy(osg::Vec3(_textBB.xMin(),_textBB.yMin(),_textBB.zMin())*matrix);
>
> bbox.expandBy(osg::Vec3(_textBB.xMax(),_textBB.yMax(),_textBB.zMax())*matrix);
>            }
>
> I'm probably missing something but I don't see the logic behind the
> first conditional.  Does it really have a purpose or is it legacy
> code?  If I change the whole chunk to this then my text is displayed
> properly:
>
>                osg::Matrix matrix;
>                matrix.makeTranslate(_position);
>                matrix.preMultRotate(_rotation);
>
> bbox.expandBy(osg::Vec3(_textBB.xMin(),_textBB.yMin(),_textBB.zMin())*matrix);
>
> bbox.expandBy(osg::Vec3(_textBB.xMax(),_textBB.yMax(),_textBB.zMax())*matrix);
>
> --
> Terry Welsh
> mogumbo 'at' gmail.com
> www.reallyslick.com
> _______________________________________________
> 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