Kevin,

Thanks for sharing. I'm sure it will come in handy...:)

Regards,
-Shayne

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Kevin
Wilder
Sent: Tuesday, February 09, 2010 4:57 PM
To: [email protected]
Subject: Re: [osg-users] dynamic_cast of referenced objects

Hi,

For anyone who is still following this thread (or for anyone who stumbles
upon it while trying to solve a similar problem in the future), I figured
I'd post my findings:

The bit about the object reference pointers vs. standard C++ pointers turned
out to be a red herring. Seems the crashes resulted from my method of
updating 2D text in the scene. I was just calling "->settext("blah")" from
the main loop whenever I wanted to change the displayed characters. The
crashes went away when I implemented a callback function to update the text.
Here's an example of my text update callback function:


Code:


struct TextUpdateCallback : public osg::Drawable::UpdateCallback
{
  virtual void update(osg::NodeVisitor* nv, osg::Drawable* drawable)
  {
    osgText::Text * TextPointer = dynamic_cast<osgText::Text*>(drawable) ;

    if ( TextPointer )
    {
      TextPointer->setText(NewText) ;
      TextPointer->setColor(NewColour) ;
    }
  }
}



 

I hope this helps.

Cheers,

Kevin[/quote]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=23879#23879





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to