Re: [osg-users] Update node color on demand

2018-11-24 Thread Eran Cohen
Hi Diego, You can pass user events to the viewer (and thus to its Event Handlers): Code: // This struct will be passed to the event handler with the relevant parameters (for example, the node you want to affect and the color to change it to) struct ChangeColorEvent : public osg::Referenced {

Re: [osg-users] Update node color on demand

2018-11-24 Thread Diego Mancilla
Hello Eran, Thank you very much for your answer. I should have been more explicit, due to the fact than I'm a newbie on OSG (and 3D development). I have an OSG viewer embedded on a Qt5 application. So the idea is that the user can change the color of one node (some dxf lines) on demand though

Re: [osg-users] Update node color on demand

2018-11-24 Thread Eran Cohen
Hi, To respond to user events you can either inherit from osg::Callback and install it on your node as an EventCallback: Code: class ColorCallback : public osg::Callback { public: virtual bool run(osg::Object* object, osg::Object* data) override { auto nv = dynam

[osg-users] Update node color on demand

2018-11-24 Thread Diego Mancilla
Hello, I'm trying to change a node color on demand from my application. The idea is that the user, once the initial rendering took place can change the color of a node by pressing a key (or something similar). I know already hoy to change the color using a NodeVisitor (previous to the rendering