Do it after you call to sceneView->update(); but before your call
sceneView->cull();

you should NOT be trying to removing or adding Nodes of the scenegraph
during its CULL or Draw traversals

You can update certain propertes of nodes during the CULL or Draw traversals






Best Regards

Gordon

__________________________________________________________
Gordon Tomlinson
Email  : gordon.tomlinson @ overwatch.com
YIM/AIM: Gordon3dBrit
MSN IM : Gordon3dBrit @ 3dSceneGraph.com

__________________________________________________________


"Self defence is not a function of learning tricks
but is a function of how quickly and intensely one
can arouse one's instinct for survival"
- Master Tambo Tetsura



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Martin Weier
Sent: Monday, May 21, 2007 7:47 AM
To: osg users
Subject: Re: [osg-users] Program design issue


Hi Robert,
Unfortuenetly I can't use a switch node. But you are telling me to do
this outside update. Can you please be a bit more precise where its safe
to remove
stuff. My main loop looks like this.

    while(renderSurface->isRealized())
        {
    ...
    // do the update traversal the scene graph - such as updating animations
        sceneView->update();

        /**************************/
        // do the cull traversal, collect all objects in the view
frustum into a sorted set of rendering bins
        sceneView->cull();
        // draw the rendering bins.
        sceneView->draw();
        // Swap Buffers
        renderSurface->swapBuffers();
    ...
    }

I really appreciate your support

Martin


Robert Osfield schrieb:
> Hi Martin,
>
> Adding and removing nodes/drawables during any traversal can
> invalidate iterators held by calling functions so its recommend, its
> best to do this outside an update callback.
>
> W.r.t adding/removing nodes, perhaps you can just switch nodes on/off
> using Node masks or a Switch node.
>
> Robert.
>
> On 5/21/07, Martin Weier <[EMAIL PROTECTED]> wrote:
>> Since I am new to OSG I need some help for my program and some hints on
>> where to start. The application needs to be able to add and remove
>> geodes from the scenegraph dynamically each frame. For this I want to
>> provide a queue of textures and primitives. that is update each frame
>> based on the current camera-/view-frustrum position. To do so the queue
>> will be entirely removed and than refilled.  Than all old geodes should
>> be remove and the new ones should be added. In my first version I tried
>> creating a group node and attached a update callback to it. During the
>> callback step I tried to remove all nodes from the scenegraph but this
>> call causes the program to crash. Since I am assuming that I can remove
>> all elements of this group node during update and add new ones, I think
>> that this crash is based on some pointer-/memory issues in my code. The
>> Debugger outputs free(): invalid pointer. Even though everything seems
>> to work fine when I remove everything expect the first.
>> However I am not sure if this is an efficient and the right way to do
>> this. So a basic description, websites, example source code or a short
>> statement on how to to all of the above would be very helpful
>> I would really appreciate some help..
>>
>> Martin
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://openscenegraph.net/mailman/listinfo/osg-users
>> http://www.openscenegraph.org/
>>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to