[osg-users] Crash when using LineSegmentIntersector
Robert Osfield
robert.osfield at gmail.com
Fri Aug 3 06:53:49 PDT 2018
Hi Sam,
Geode used to be the leaf node in the scene graph that could only have
Drawable as children, no traditional node types could be added to a
Geode, so with older versions of the OSG what you are attempting
wouldn't even compile.
I don't recall the exact date, but in the last few years I relaxed the
scene graph so that Drawable leaves could be added to any Group in the
scene graph, so now the Geode only exists for backwards compatibility.
For a modern scene graph I wouldn't create any Geode's at all. In
doing this I had to relax the Geode so it's more in-line with a normal
Group, but this unfortunately means that you can do things like you
are doing, i.e. adding a Geode as a child to a Geode, which is an
unfortunately side effect.
In you code you are still using a Geode so it's old school OSG, but
you are nesting a Geode within a Geode, which is really not a good
practice. I really don't know why you are even using a Geode here.
It makes me think that you whole approach is a bit confused.
However, as I've only seen a tiny snippet of your code and explanation
I can't really say where you've understanding of how best to implement
what you need has gone off in the weeds. The fact that it's crashing
is a good sign that something has gone wrong, and nesting of a Geode,
even if it isn't the cause is another indication that you probably
just need to take a step back.
Another general comment is that it's not recommend practice to go
adding objects to the scene graph from within a NodeVisitor. It's all
too easy to invalidate iterators and end up in a right old mess.
Robert.
More information about the osg-users
mailing list