Hello
I have some problem with osgText::Text.
I tried to do the following:
I create a osg::Group And attach to it a osg::Geode
To the Geode I add a drawable osgText::Text.
later I set Update Callback to the osgText::Text, and in that callback
I change the text via setText.
I have 1 integer and 1 float in the text with I put them in a string
via sprintf.
The problem is that the text disappear after I change some value in
the text (usually when I change the float).
It's not consistent, it's disappear and then show up again after another change.
m_GroupInterceptorData = new osg::Group;
m_GroupInterceptorData->setNodeMask(GODS_VIEW_MASK);
m_TextInterceptorData = new osgText::Text;
osgText::Font *font = osgText::readFontFile("fonts/mriam.ttf");
TextInterceptorData ->setCharacterSize(AIRCRAFT_DATA_TEXT_SIZE);
TextInterceptorData ->setAxisAlignment(osgText::Text::XY_PLANE);
TextInterceptorData ->setLayout(osgText::Text::LEFT_TO_RIGHT);
TextInterceptorData ->setFont(font);
TextInterceptorData ->setFontResolution(AIRCRAFT_DATA_TEXT_SIZE,
AIRCRAFT_DATA_TEXT_SIZE);
TextInterceptorData ->setAlignment(osgText::Text::LEFT_CENTER);
TextInterceptorData
->setCharacterSizeMode(osgText::Text::SCREEN_COORDS);
TextInterceptorData ->setColor(AIRCRAFT_DATA_COLOR);
osg::Geode *geodeInterceptor = new osg::Geode();
geodeInterceptor->addDrawable(m_TextInterceptorData.get());
geodeInterceptor->setUpdateCallback(new
CInterceptorDataUpdateCallback(m_SceneManager));
m_GroupInterceptorData->addChild(geodeInterceptor);
The callback:
char content[128];
sprintf(content,"H: %d Kft\nV: %.1lf
Mach",heightAboveTerrain,velocity);
osgText::Text* text =
(osgText::Text*)(currentGeode->getDrawable(0));
text->setText(content);
text->setPosition(position);
Help please...
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/