On a similar note, does anyone know what the performance costs of
adding/removing nodes from the scene graph at runtime are compared to,
say, using a Switch or manipulating NodeMasks to hide objects? That is,
is the performance hit from adding/removing nodes greater or less than
any loss in performance due to "ignoring" existing (but temporarily
unwanted) nodes? For the sake of this discussion, assume that a good
number of nodes are involved - not just a few here or there.

 

I was planning on running some tests myself on this subject, but since
this question came up, I thought I'd see if anyone else has already
looked into this.

 

Matthew W. Fuesz

Software Engineer Asc.

Lockheed Martin STS

1210 Massillon Road

Akron, OH 44315

[EMAIL PROTECTED]

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Thrall,
Bryan
Sent: Thursday, June 19, 2008 1:27 PM
To: [EMAIL PROTECTED]; OpenSceneGraph Users
Subject: Re: [osg-users] Adding a child to a node at runtime.

 

James Reid wrote on Thursday, June 19, 2008 12:13 PM:

 

> Howdy!

> 

>     When I try to add a child to a node at runtime I get an exception.

 

> Unfortunately, the exception dies quietly so I'm not sure what the

actual

> exception is.  I know I've done this before (a long time ago) and

things have

> changed since then, so I'm not sure what I'm doing wrong.  Here's the

setup

> of our app.    

> 

> We're rendering on a managed window using managed c++

> We have a button that enables/disable certain graphics to be drawn.

> To do the hiding of a graphic, I remove the geode from it's parent

node.

> To do the showing of a graphic, I add the geode to the parent. <- this

causes

> the exception 

> 

> We're building a simulation and our users can toggle certain graphics

on/off.

> For example, they can view graphic, physics, center of mass,

constraints,

> etc...  They can view any number of these at any time.  

> 

> My current set up is I have a Geode for each representation.  I then

> add/remove that geode depending on the display settings. 

> 

> Is this the wrong setup?  I've searched for similar solutions and

haven't

> really found anything.  Maybe I'm looking in the wrong places? 

 

It isn't safe to modify the scenegraph during the cull and draw passes;

it's best to use a UpdateCallback, or to replace your call to frame()

with your own that modifies the scenegraph before doing the cull and

draw.

 

There are other ways to show/hide geometry, such as the node mask or a

CullCallback; not that what you're doing is wrong, but perhaps they

might do what you want better.

 

-- 

Bryan Thrall

FlightSafety International

[EMAIL PROTECTED]

_______________________________________________

osg-users mailing list

osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to