Hi,
I have a scene with moving teams (represented as spheres) and I want to place
an osgText above each of these team such that the text movels along the object.
I tried the following code (teamPos is the node representing the team, lat, lon
and z is the current team position):
osg::ref_ptr teamLabel = new osgText::Text();
osg::ref_ptr g_font =
osgText::readFontFile("fonts/arial.ttf");
teamLabel->setDataVariance(osg::Object::DYNAMIC);
teamLabel->setFont(g_font.get());
teamLabel->setCharacterSize( 100.0 );
teamLabel->setFontResolution( 22, 22 );
teamLabel->setColor( osg::Vec4(1.0,1.0,1.0,0.5) );
teamLabel->setPosition( osg::Vec3f(lon,lat,z) );
teamLabel->setAlignment( osgText::Text::CENTER_TOP );
teamLabel->setAxisAlignment(osgText::TextBase::SCREEN);
teamLabel->setCharacterSizeMode( osgText::Text::SCREEN_COORDS );
teamLabel->setBackdropType( osgText::Text::OUTLINE );
teamLabel->setBackdropColor( osg::Vec4(0,0,0,1) );
teamLabel->setBackdropImplementation( osgText::Text::STENCIL_BUFFER
);
teamLabel->setBackdropOffset(0.2f,0.2f);
teamLabel->setAutoRotateToScreen( true );
teamLabel->setText( teamString.toStdString().c_str() );
osg::ref_ptr positionGeode = new osg::Geode;
positionGeode->addDrawable(teamPos);
positionGeode->addDrawable(teamLabel);
Has anybody got an idea what I am doing wrong?
Thank you!
Cheers,
jo
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=46089#46089
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org