[osg-users] Robert: I figured it out :-) (was: Is it possible to know when the node-graph is 'dirty'?)

Viggo Løvli vigigio at hotmail.com
Fri Jul 25 01:42:08 PDT 2008

Hi Robert,
> Hi Viggo,> > The rendering backend uses ref_ptr<>'s so there shouldn't be any leak,> assigning the new RenderBin will lead to the previous one being> deleted.> 
Yep I figured out that one :-)
> Rather than second guess what will be need might I suggest you> maintain a recycling list of ref_ptr<> to your custom RenderBin, then> traverse this list to find an entry that has a referenceCount() of> one, then take ownership of this.> 
I took into usage a std::list which starts off empty. I am currently counting how many times cull-traverse is called and increasing the list at need. 
Your idea of checking the reference count is better. It will make the system more robust.
I will continue using a std::list for this.
I will keep track of what was the last used element of the list, so when I need a new one then I will traverse the list from that point. This should increase the chance of finding a free entry immediately.
If I parse through the whole list, then I will insert a new element to the list and use that one. 
The list will thus grow to the maximum needed size and stay there until the class is deleted. Future changes of number of cameras or what ever re-configurations that can cause one thread to hold data longer will thus automatically work.
I am also ensuring that the original RenderBinList of RenderStage is not changed anywhere else than for element 10. I used to add a new bin to element 9, but that may be in usage already. Element 10 will instead point to a new bin that contain it's own bin #9 and #10. Both will point to the original content that RenderStage pointed to in it's bin #10.
> Robert.> _______________________________________________> osg-users mailing list> osg-users at lists.openscenegraph.org> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Hold kontakten med Windows Live Messenger.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080725/590bf5f2/attachment-0003.htm>

More information about the osg-users mailing list