Trying to add Text to globe #1926
-
I have this code here: const std::string text = Stringify () << "Location: " << lat << ", " << lon;
osgText::Text *label = new osgText::Text ();
label->setText (text);
label->setColor (Color::Red);
label->setPosition (osg::Vec3 (X, Y, Z));
label->setAlignment (label->CENTER_CENTER);
label->setAutoRotateToScreen (true);
label->setCharacterSizeMode (label->SCREEN_COORDS);
label->setCaracterSize (20.0f);
label->setFont ("arialbd.ttf");
Group->addChild (label); I grabbed this code from the osgearth_atlas.cpp example. The Group I have has been added to the MapHelperNode variable. What I am seeing is the text only displaying when I am tilted towards the sky. Whenever I am facing the globe itself, it cannot be seen. If I hit 'w' for the wireframe I can see that is still being drawn in this same location, but it is being obstructed in some way and I am not sure why. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I figured this out on my own. I needed to use osgText::Text3D. |
Beta Was this translation helpful? Give feedback.
-
Why do not use osgEarth::LabelNode? |
Beta Was this translation helpful? Give feedback.
I figured this out on my own. I needed to use osgText::Text3D.