[osg-users] Replacement of subtrees

Chris 'Xenon' Hanson xenon at alphapixel.com
Tue Apr 12 09:02:24 PDT 2011


On 4/12/2011 1:11 AM, Martin Haffner wrote:
> Thanks for your answer!
> Well, the last 3 children of the LOD node are Geodes where each of the Geode contains about 30 to 70 Drawables. They represent a triangulated road on 3 LOD (high, mid, low poly count).
> When the user edits the road I have to retessellate and create new vertices. Thus I have to delete all old Drawables (of all 3 Geodes) and add the new Drawables (with the new Vertices).
> I just fear that all the delete and new calls may be slow and I wonder if there is a better way to do this.

  I don't know how much overhead the Drawable remove/add would cause, really.

  I believe you could simply construct new arrays of vertices and primitives, and then
swap them into the existing drawables.

  Another source of overhead is sometimes the allocation and deallocation of the
std::vector that store the drawable vertex/texcoord/normal/color/primitive arrays.
Consider not removing and deleting the old arrays, but rather, removing, clearing and
reusing them.

-- 
Chris 'Xenon' Hanson, omo sanza lettere. Xenon at AlphaPixel.com http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting.
    "There is no Truth. There is only Perception. To Perceive is to Exist." - Xen



More information about the osg-users mailing list