Hi,

I have a program which is using a custom viewer derived from osgViewer::View.  
In this custom view's scene may be some custom types derived from osg::Geode.  
I'll call these MyView and MyGeode for the sake of the post.  MyView's are put 
inside a osgViewer::CompositeViewer.  All this works great.  Now, I want to 
send custom events to MyView and MyGeode.  

My original hope was that I could just register a handler on MyView and MyGeode 
and do something like "compositeViewer->accept(new MyEvent)", but it doesn't 
seem that easy.

I ended up creating a "MyCompositeViewer" that has an "accept" function on it 
that takes MyOsgGaEventVisitor and then create a MyGUIEventHandler which 
attempts to dynamic_cast osgGA::GUIEventAdapter to MyEventAdapter.  
MyGUIEventHandler is created with a pointer to its owning MyView and then can 
make calls into MyView based on the event.  I haven't started working on 
getting the event into MyView's scene and onto MyGeode's yet because this 
design is challenging my sanity.

This approach works, but seems like a mess.  Before I get too far down this 
rabbit hole, what is the RIGHT way to get a custom event sent from a top-level 
CompositeViewer to its subordinate views and then onto the view's scene nodes?  
The examples in OSG seem to address parts of this problem, but I can't see a 
solution to the entire scope of the problem.  Another way to phrase the 
question might be:

"How do I create a custom OSG-wide event that can be responded to by all 
osgViewer::View's and osg::Geode's alike?"

Thank you!

Cheers,
John

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=62866#62866





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to