Hello OSGers! :)

I am porting an application from OSG3.0.0 to OSG3.0.1. One of the reasons I am 
doing this is because of a well known bug with osgText::Text. In the new 
version of OSG this problem is fixed and the text renders perfectly. In my 
application I have a series of text labels (osgText::Text) attached to some 
nodes in my scenegraph. All these nodes combined result a bounding sphere with 
a radius of 25 units. The labels are configured like this:


Code:

osgText::Text* label = new osgText::Text;
label->setDataVariance(osg::Object::DYNAMIC);
label->setFont( font );
label->setCharacterSize( 22 );
label->setFontResolution( 22, 22 );
label->setColor( osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f ));
label->setPosition( position );
label->setAlignment( osgText::Text::CENTER_BASE_LINE );
label->setAxisAlignment( osgText::Text::SCREEN );
label->setCharacterSizeMode( osgText::Text::SCREEN_COORDS ); // I tried 
OBJECT_COORDS too. It won't make any difference.
label->setBackdropColor(osg::Vec4(0,0,0,1));
label->setBackdropType( osgText::Text::OUTLINE );
label->setBackdropImplementation( osgText::Text::STENCIL_BUFFER );
label->setBackdropOffset(0.2f,0.2f);
label->setAutoRotateToScreen( true );
label->setText( my_label_text );




At some point in my application I wants to calculate the overall bounding 
sphere of my scenegraph (which only includes my model nodes with the attached 
labels) by calling the function osg::Node::getBound() on my root node. When I 
do this, the BoundingSphere I get has a huge radius, and not a radius of 25 
units. Looks like OSG calculates the bounding sphere of the osgText::Text in 
screen space and does not map the screen space bounding sphere coordinates to 
the current model view space coordinates. Is there any way to do this 
automatically? Or somehow tell OSG not to take into consideration the 
osgText::Text bounding spheres when calculating the bounding sphere of the 
whole scenegraph?
One solution I can think of is to set a custom ComputeBoundingSphereCallback 
and do all the calculations myself. Any other ideas? Thanks a lot for your time!

Cheers,
George

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





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to