Hi all,
I am currently experiencing some issues to update often the text of an
osgText::Text. I m working with osg 2.8.1.
While draging the mouse i need to update the text of an osgText, so this
update is called very often.
So i have done a class inherating of osg::Drawable::DrawCallback, wich i
attach to my osgText::Text as an update callback :
And in the following code ClassC is a class inherating of osg::Geode and
containing the osgText.
When the mouse is draging i set a flag _needUpdate of my ClassC class to
true, then text is updated in the callback if needed.
* class TextDrawCallback : public virtual osg::Drawable::DrawCallback
{
private:
osg::ref_ptr <ClassC> _myElement;
public:
TextDrawCallback ( ClassC * element ) : _myElement ( element ) { }
virtual void drawImplementation ( osg::RenderInfo& renderInfo, const
osg::Drawable * drawable ) const
{
// if the flag is to true
if ( _myElement->getNeedUpdate() )
{
std::string newValue = anything computed
_myElement->getOsgText()->setText( newValue );
_myElement->setNeedUpdate( false ); // no need update
anymore
}
drawable->drawImplementation ( renderInfo );
}
};*
This works well under linux but make sometimes crashes under windows XP. The
crash appear in the code called by *
drawable->drawImplementation ( renderInfo );
*but i cant find out the main reason.
Did i something wrong with this callback ?
Thanks for your attention.
Regards,
Harold
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org