hey...
I did all of the things you wrote to me and still the text is disappear :(
I think it's somehow related to the fact that the osgText is over a .flt model
(in ortho view).
that thought came to me after I moved the text away of the model and
the problem gone.
But I prefer a final solution because the text is supposed to be over
the model...
Is the fact that the text is over the model give more information???
Shoham.
On 1/21/07, Robert Osfield <[EMAIL PROTECTED]> wrote:
HI Shoham,
I can't really say what might be the cause of the problem, there are
just too many things that could be going on in your app.
General comments on the callback is that rather than use a
NodeCallback try attaching the callback to the Text itself
(Drawable::UpdateCallback).
Also in your code don't use C casts use dynamic_cast<osgText::Text*>()
instead and check the return value to make sure its non null.
Another defensive programming time would be to not do a getDrawable(0)
without first checking that enough drawable exist as there is always a
chance you scene graph isn't set up correctly and as your intend.
The last item to be aware of is management of multiple graphics
contexts, this may or may not have some baring on your app as I know
nothing about your app.
Robert.
On 1/21/07, Shoham Ben-Har <[EMAIL PROTECTED]> wrote:
> 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/
>
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/