[osg-users] Problems with osgText::Text internal transformations and LineSegmentIntersector

Brian Hutchison bhutchison at systra.com
Tue Mar 20 03:46:13 PDT 2018


Hi,

When I use any of the following methods to reposition osgText::Text the picking fails when used with LineSegmentIntersector.


Code:

text->setPosition() // anything other than {0.0,0.0,0.0}
text->setRotation() // anything other than osg::Quat(0.0, osg::Z_AXIS)
text->setAlignment() // anything other than LEFT_BOTTOM




As far as I can work out from debugging, the bounds are being correctly calculated and "intersectAndClip" is returning true.  The problem seems to be when "drawable->accept" is called in the "intersect" method, the IntersectFunctor does not have the transformations that Text is using and the vertices passed to it are not transformed.

The only way I can find around this is to place the text inside PositionAttitudeTransform's and do the positioning myself.  Unfortunately, since I do not know the eventual dimensions of the text, doing a CENTER_CENTER alignment is practically impossible.

If I leave the alignment to be done by Text then a CENTER_CENTER alignment means that you can only pick the top left quarter of the text.

I have tried placing the text inside either a Geode or a Group but it makes no difference.

I would be very happy if I was simply not calling something I should be to initalise the Text or its container correctly.

We are using OSG 3.5.6 statically linked via VCPKG.

Any help gratefully received,

Thanks,

Brian[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73137#73137







More information about the osg-users mailing list