[osg-users] remove updatecallback stably and reliably

蔡少波 beijihuohu at 126.com
Sat Dec 26 17:01:11 PST 2020







Hi,
   I have some problems encountered in the project to ask everyone.
Question 1: The following function parameter t does not seem to be set to the specified value. It is found in the callback function of osg::Node that even if t is set to the specified value, the ReferenceTime in the callback function still starts from 0. Is there any way to make ReferenceTime from the specified value?
viewer->getFrameStamp()->setReferenceTime(double t)
Question 2: osg:Group cannot generate and add a large number of nodes at one time, nor can it repeatedly add and delete all child nodes, otherwise it will crash. Is there any way to add a large number of nodes at once?  Can repeatedly add and delete a large number of child nodes?
Question 3: How to remove the updatecallback of a node stably and reliably? How to remove a node that is being updated stably and reliably?
       My rendering is done in a separate thread,
    while(!viewer->done())
    {
        osg->PreFrameUpdate();
        viewer->frame();
        osg->PostFrameUpdate();
    }
I call node->removeUpdateCallback(callback) in the preFrameOpration->Operation()  function  will cause a crash.
  I call node->setUpdateCallback(callback) again for a node that has already called node->setUpdateCallback(callback) will cause a crash.
Do you have a stable and reliable way to achieve this goal?
void PreFrameUpdate()
{
   if (preFrameOpration != nullptr)
   {
      preFrameOpration->Operation();
      delete preFrameOpration;
     preFrameOpration = nullptr;
 }
}
























-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20201227/277fa5e7/attachment.html>


More information about the osg-users mailing list