[osg-users] Crash when using LineSegmentIntersector

Robert Osfield robert.osfield at gmail.com
Sun Aug 5 02:02:33 PDT 2018


On Sat, 4 Aug 2018 at 17:24, Sam Brkopac <brkopac at gmail.com> wrote:
> Most of the OSG examples use Geodes. What is the type you would use for a modern scene graph?

Most of the examples pre-date the change to allow Drawables to be
added directly to the scene graph.  Since there are so many examples
it's a bit of task to rewrite them all.  New examples won't use Geode.

>
>
> > 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.
>
>
> This is a very real possibility. To keep it short and sweet: I have a plugin that returns a geode from a custom file format. There is supporting data associated with the format such as walkable flags. I use Geodes to group together drawables (using the visitor) to draw them if the user wants to see them. Basically debug data for the node.

All classes of osg::Object have support for a object->setValue("name",
valu) and bool result = object->getValue("name", value);  This is what
I'd use for debug/supporting data.

Nest a Geode within a Geode is just plan bad practice.  It's misusing
something that was never intended to be used in the way you were using
it.  There are *no* OSG examples that do what you were doing, you've
invented a new way to misuse the OSG.

> > Another general comment is that it's not recommend practice to go
> > adding objects to the scene graph from within a NodeVisitor.
>
> Understood. Is there a best practice I can align myself with? Should I be handling that all in the plugin loader and potentially use something like osg::Switch to turn them on and off?

I don't know enough about what you are doing to pinpoint exactly what
you should use for the task.  At this point you've provided a
"solution" that you want to debug, what I'm saying is the "solution"
has a number of odd things about it is likely completely the wrong way
to tackle that task.

The best way to get feedback on how to do things is provide a clear
high level explanation of what functionality you'd like to implement
then others can suggest the way they would tackle it.

Robert.


More information about the osg-users mailing list