<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><p style="margin: 0;"><span style="font-size: 18px;">Hi Robert,</span></p><div style="position:relative;zoom:1"><div style="clear:both"></div></div><div id="divNeteaseMailCard"></div><p style="margin: 0;"><span class="JLqJ4b ChMk0b" style="background-color: rgb(210, 227, 252); color: rgb(0, 0, 0); cursor: pointer; font-family: Roboto,RobotoDraft,Helvetica,Arial,sans-serif; font-size: 18px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre-wrap; word-spacing: 0px;" data-phrase-index="0" data-language-to-translate-into="auto" data-language-for-alternatives="en" jsname="txFAF" jsdata="uqLsIf;_;$1906" jsmodel="SsMkhd" jscontroller="Zl5N8" jsaction="agoMJf:PFBcW;usxOmf:aWLT7;jhKsnd:P7O7bd,F8DmGf;Q4AGo:Gm7gYd,qAKMYb;uFUCPb:pvnm0e,pfE8Hb,PFBcW;f56efd:dJXsye;EnoYf:KNzws,ZJsZZ,JgVSJc;zdMJQc:cCQNKb,ZJsZZ,zchEXc;Ytrrj:JJDvdc;tNR8yc:GeFvjb;oFN6Ye:hij5Wb"><span jsname="W297wb" jsaction="click:qtZ4nf,GFf3ac,tMZCfe; contextmenu:Nqw7Te,QP7LD; mouseout:Nqw7Te; mouseover:qtZ4nf,c2aHje">     The last few questions were too fragmented. I will introduce the needs of our project. We need to read symbol information from the database and generate symbols based on their coordinates, including text and geometry. The number of these symbols is about several thousand to several.</span></span><span style="display: inline !important; float: none; background-color: rgb(245, 245, 245); color: rgb(0, 0, 0); font-family: Roboto,RobotoDraft,Helvetica,Arial,sans-serif; font-size: 18px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre-wrap; word-spacing: 0px;"> </span><span class="JLqJ4b ChMk0b" style="color: rgb(0, 0, 0); cursor: pointer; font-family: Roboto,RobotoDraft,Helvetica,Arial,sans-serif; font-size: 18px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre-wrap; word-spacing: 0px;" data-phrase-index="1" data-language-to-translate-into="auto" data-language-for-alternatives="en" jsname="txFAF" jsdata="uqLsIf;_;$1907" jsmodel="SsMkhd" jscontroller="Zl5N8" jsaction="agoMJf:PFBcW;usxOmf:aWLT7;jhKsnd:P7O7bd,F8DmGf;Q4AGo:Gm7gYd,qAKMYb;uFUCPb:pvnm0e,pfE8Hb,PFBcW;f56efd:dJXsye;EnoYf:KNzws,ZJsZZ,JgVSJc;zdMJQc:cCQNKb,ZJsZZ,zchEXc;Ytrrj:JJDvdc;tNR8yc:GeFvjb;oFN6Ye:hij5Wb"><span jsname="W297wb" jsaction="click:qtZ4nf,GFf3ac,tMZCfe; contextmenu:Nqw7Te,QP7LD; mouseout:Nqw7Te; mouseover:qtZ4nf,c2aHje">Between 10,000, users are unwilling to use the display and hide switch to gradually generate symbols. In addition to these symbols, the project requires a dynamic simulation function. This simulation process is a dynamic simulation of several different objects. The simulation action uses time as the</span></span><span style="display: inline !important; float: none; background-color: rgb(245, 245, 245); color: rgb(0, 0, 0); font-family: Roboto,RobotoDraft,Helvetica,Arial,sans-serif; font-size: 18px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre-wrap; word-spacing: 0px;"> </span><span class="JLqJ4b ChMk0b" style="color: rgb(0, 0, 0); cursor: pointer; font-family: Roboto,RobotoDraft,Helvetica,Arial,sans-serif; font-size: 18px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre-wrap; word-spacing: 0px;" data-phrase-index="2" data-language-to-translate-into="auto" data-language-for-alternatives="en" jsname="txFAF" jsdata="uqLsIf;_;$1908" jsmodel="SsMkhd" jscontroller="Zl5N8" jsaction="agoMJf:PFBcW;usxOmf:aWLT7;jhKsnd:P7O7bd,F8DmGf;Q4AGo:Gm7gYd,qAKMYb;uFUCPb:pvnm0e,pfE8Hb,PFBcW;f56efd:dJXsye;EnoYf:KNzws,ZJsZZ,JgVSJc;zdMJQc:cCQNKb,ZJsZZ,zchEXc;Ytrrj:JJDvdc;tNR8yc:GeFvjb;oFN6Ye:hij5Wb"><span jsname="W297wb" jsaction="click:qtZ4nf,GFf3ac,tMZCfe; contextmenu:Nqw7Te,QP7LD; mouseout:Nqw7Te; mouseover:qtZ4nf,c2aHje">Marked, so we use AnimationPathCallback, but this faces a time benchmark problem. Although the method of pre-calculating relative time can be used to circumvent this problem, it is not a good way to solve the problem mechanically. The last problem is to</span></span><span style="display: inline !important; float: none; background-color: rgb(245, 245, 245); color: rgb(0, 0, 0); font-family: Roboto,RobotoDraft,Helvetica,Arial,sans-serif; font-size: 18px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre-wrap; word-spacing: 0px;"> </span><span class="JLqJ4b ChMk0b" style="color: rgb(0, 0, 0); cursor: pointer; font-family: Roboto,RobotoDraft,Helvetica,Arial,sans-serif; font-size: 18px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre-wrap; word-spacing: 0px;" data-phrase-index="3" data-language-to-translate-into="auto" data-language-for-alternatives="en" jsname="txFAF" jsdata="uqLsIf;_;$1909" jsmodel="SsMkhd" jscontroller="Zl5N8" jsaction="agoMJf:PFBcW;usxOmf:aWLT7;jhKsnd:P7O7bd,F8DmGf;Q4AGo:Gm7gYd,qAKMYb;uFUCPb:pvnm0e,pfE8Hb,PFBcW;f56efd:dJXsye;EnoYf:KNzws,ZJsZZ,JgVSJc;zdMJQc:cCQNKb,ZJsZZ,zchEXc;Ytrrj:JJDvdc;tNR8yc:GeFvjb;oFN6Ye:hij5Wb"><span jsname="W297wb" jsaction="click:qtZ4nf,GFf3ac,tMZCfe; contextmenu:Nqw7Te,QP7LD; mouseout:Nqw7Te; mouseover:qtZ4nf,c2aHje">To meet the needs of users to start and stop the simulation process at any time, this requires a safe and secure RemoveUpdateCallBack and delete nodes generated during the simulation process.</span></span><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></p><p>ÔÚ 2020-12-27 20:42:05£¬"Robert Osfield" <robert.osfield@gmail.com> Ð´µÀ£º</p><blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div dir="ltr"><div dir="ltr">On Sun, 27 Dec 2020 at 01:01, ²ÌÉÙ²¨ <<a href="mailto:beijihuohu@126.com">beijihuohu@126.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="line-height:1.7;color:rgb(0,0,0);font-size:14px;font-family:Arial"><p style="margin:0px"><span style="font-variant-numeric:normal;font-variant-east-asian:normal;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;white-space:pre-wrap">   </span><span style="font-variant-numeric:normal;font-variant-east-asian:normal;background-color:rgb(210,227,252);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:20px;white-space:pre-wrap">I have some problems encountered in the project to ask everyone.</span></p></div></blockquote><div><br></div><div>As a general tip, it's best to post a single question per post so that the threads that follow can remain focused on one topic rather than have several topics all interleaved together making it harder to follow and harder for others later who are searching for answers.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="line-height:1.7;color:rgb(0,0,0);font-size:14px;font-family:Arial"><div id="gmail-m_-6745280152543644693content"><div style="color:rgb(0,0,0);font-family:Arial;font-size:14px;line-height:1.7"><div id="gmail-m_-6745280152543644693content" style="color:rgb(0,0,0);font-size:14px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="color:rgb(0,0,0);font-family:Arial;font-size:14px;line-height:1.7"><div style="margin:0px"><span style="color:rgb(0,0,0);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px">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?</span><span style="background-color:rgb(245,245,245);color:rgb(0,0,0);display:inline;float:none;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"> </span><span style="color:rgb(0,0,0);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"><br></span><span style="color:rgb(0,0,0);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px">viewer->getFrameStamp()->setReferenceTime(double t)</span></div></div></div></div></div></div></blockquote><div><br></div><div>The FrameStamp has a ReferenceTime and SimulationTime, for animations it's recommended you use the SimulationTIme.</div><div><br></div><div>The FrameStamp is set on each new frame in the Viewer::advance(double simulationTime) method, so if you are writing your own frame loop you'll call this with the parameter you want.</div><div><br></div><div>If you are calling the higher level Viewer::frame() method then it also takes the optional simulationTime, or the higher still Viewer::run() that also takes an optional double parameter for setting the simulationTime.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="line-height:1.7;color:rgb(0,0,0);font-size:14px;font-family:Arial"><div id="gmail-m_-6745280152543644693content"><div style="color:rgb(0,0,0);font-family:Arial;font-size:14px;line-height:1.7"><div id="gmail-m_-6745280152543644693content" style="color:rgb(0,0,0);font-size:14px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="color:rgb(0,0,0);font-family:Arial;font-size:14px;line-height:1.7"><div style="margin:0px"><span style="color:rgb(0,0,0);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px">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?<br></span></div></div></div></div></div></div></blockquote><div><br></div><div>You can add and removing large number of children but how to do it safely will depend upon the threading model your applcation you are using and how you got about adding/removing the nodes.</div><div><br></div><div>As a general note, it's likely very inefficient to create and delete objects, especially ones that OpenGL objects associated with them.  If you can reuse data or change how you do things to avoid creating and deleting entirely then this will be the most efficient way to do things.  For instance it may be possible to move work entirely to the GPU so the scene graph itself is almost entirely static and only uniforms or small packets of data need updating each frame.</div><div><br></div><div>You don't provide any information about how you are doing things or for what reason so we can't provide any specific recommendations.  The best thing to do would be to take a big step back and describe what you are trying to achieve in your application from a really high level rather diving into low level details about how you've decided to implement something.</div><div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="line-height:1.7;color:rgb(0,0,0);font-size:14px;font-family:Arial"><div id="gmail-m_-6745280152543644693content"><div style="color:rgb(0,0,0);font-family:Arial;font-size:14px;line-height:1.7"><div id="gmail-m_-6745280152543644693content" style="color:rgb(0,0,0);font-size:14px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="color:rgb(0,0,0);font-family:Arial;font-size:14px;line-height:1.7"><div style="margin:0px"><span style="color:rgb(0,0,0);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"><span style="background-color:rgb(210,227,252);color:rgb(0,0,0);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"><span>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?</span></span><span style="color:rgb(0,0,0);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"><span><br>       </span></span><span style="background-color:rgb(245,245,245);color:rgb(0,0,0);display:inline;float:none;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"> </span><span style="color:rgb(0,0,0);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"><span>My rendering is done in a separate thread,<br><font face="Arial" size="3">    while(!viewer->done())<br>    {<br>        osg->PreFrameUpdate();<br>        viewer->frame();<br>        osg->PostFrameUpdate();<br>    }<br> <span style="background-color:rgb(210,227,252);color:rgb(0,0,0);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"><span> I call node->removeUpdateCallback(callback) in the preFrameOpration->Operation()  function  <span style="background-color:rgb(255,255,255);color:rgb(0,0,0);display:inline;float:none;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px">will cause a crash.<br>  I </span>call node-><span style="background-color:rgb(245,245,245);color:rgb(0,0,0);display:inline;float:none;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"></span><span style="color:rgb(0,0,0);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"><span>setUpdateCallback(callback)</span></span> again for a node that has already called node->setUpdateCallback(callback)</span></span><span style="background-color:rgb(245,245,245);color:rgb(0,0,0);display:inline;float:none;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"> </span><span style="color:rgb(0,0,0);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"><span> will cause a crash.</span></span><span style="color:rgb(0,0,0);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"><span><br></span></span><span style="color:rgb(0,0,0);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:18px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px"><span>Do you have a stable and reliable way to achieve this goal?<br><font face="Arial" size="3">void PreFrameUpdate()<br>{</font></span></span><br>   if (preFrameOpration != nullptr)<br>   {<br>      preFrameOpration->Operation();<br>      delete preFrameOpration;<br>     preFrameOpration = nullptr;<br>  }<br>}</font></span></span></span></div></div></div></div></div></div></blockquote><div><br></div><div>Again you don't really provide enough information for us to be able to guide you in a specific direction.</div><div><br></div><div>Best I can say is that the osgViewer by default will run the Viewer::frame() operations multi-threaded.  Running the frame loop itself in it's own thread could also introduce problems if you are updating the scene graph at the same time as another thread is reading it.</div><div><br></div><div>You could set the Viewer threading model to SingleThreaded via viewer.setThreadingModel(osgViewer::Viewer::SingleThraeded) and see what happens.  It might provide some insight.</div><div><br></div><div>But again best I can do is arm wave at this point as you've provided small bits of you what you are doing. so much is left to our imaginations.  You haven't provided any information about the nature of the crash/stack trace.</div><div><br></div><div>Rather than attempt to provide lots more low level chunks of information the single best thing you can do it to describe what you are trying to achieve with your application, then describe what approach you've decided to implement and why, then go into the nature of the crash, information about your OSG version, platform etc.</div><div><br></div><div>I say this as there could well be a very different approach you should be taking that will avoid such much complexity and inefficiency.</div><div> </div></div></div>
</blockquote></div>