Hello,
I've updated my old OSGUIsh library, so that it works with newer
versions of OSG. This small library allows to register functions that
get called when "GUI-like events" (mouse click, mouse move, key
down...) happen on a specific OSG node.
It can be used more or less like this:
// First you define a callback
void HandleClick(OSGUIsh::HandlerParams& params)
{
std::cout << "Click on node '" << params.node << "'!\n";
}
// Later, you connect the events to the callbacks
osgViewer::Viewer viewer;
osg::ref_ptr<OSGUIsh::EventHandler> guishEH(
new OSGUIsh::EventHandler());
viewer.addEventHandler(guishEH);
osg::ref_ptr<osg::Node> loadedModel =
osgDB::readNodeFile("Some3DModel.obj");
guishEH->addNode(loadedModel);
guishEH->getSignal(loadedModel, "Click")->connect(&HandleClick);
I don't think it is currently good enough for production use, but I
guess it is a lot better than starting from scratch :-)
It can be downloaded from here: http://www.stackedboxes.org/~lmb/osguish/
Cheers,
LMB
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org