Re: [osg-users] Switch node not working the second time I change the values
Thanks Robert. I had edited my earlier post to include the code. With your mention of managing the viewer, I placed breakpoints and found that I just needed to use setRunFrameScheme(osgViewer::ViewerBase::CONTINUOUS); Works now. Thanks :-) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48562#48562 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Switch node not working the second time I change the values
Hi Nav, The redraw of the window is down to your application and how it manages the frame loop. As you've said nothing about how you are managing the viewer/windows there is nothing we can add. Robert. On 27 June 2012 09:03, Nav Joseph wrote: > Correction: Just tried the same program, and the switching between textures > is happening. When I click and drag, an object in the viewer rotates. When I > simply click on the viewer, the object stops rotating. > After clicking, when I drag to rotate the object, I see that the texture > switch had happened. I guess it didn't refresh for god knows what reason. > How can I ensure that the refresh happens? > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=48555#48555 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Switch node not working the second time I change the values
Correction: Just tried the same program, and the switching between textures is happening. When I click and drag, an object in the viewer rotates. When I simply click on the viewer, the object stops rotating. After clicking, when I drag to rotate the object, I see that the texture switch had happened. I guess it didn't refresh for god knows what reason. How can I ensure that the refresh happens? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48555#48555 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Switch node not working the second time I change the values
Created a switch node for which I set true and false values, and it works. The Geodes contain one texture each. I declared buttonSwitch as a global, outside main. Code: osg::ref_ptr buttonSwitch = new osg::Switch; osg::ref_ptr geode1 = new osg::Geode; osg::ref_ptr geode2 = new osg::Geode; geode1->addDrawable( quad1.get() ); geode2->addDrawable( quad2.get() ); buttonSwitch->addChild(geode1.get(),false); buttonSwitch->addChild(geode2.get(),true); camera->addChild( buttonSwitch.get() ); But when I try to switch on a mouse click, it does not work Code: virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { osgViewer::View* view = static_cast(&aa); if ( view ) { switch ( ea.getEventType() ) { case osgGA::GUIEventAdapter::PUSH: std::cout<<"Push"setValue(0,false);buttonSwitch->setValue(1,true);} else {buttonSwitch->setValue(0,true);buttonSwitch->setValue(1,false);} break; The control reaches the setValue line. I checked with a breakpoint. But I don't see the textures switching between visible and not visible. Is some kind of a refresh required to show the switched texture? Additionally, I was using this technique to implement a button on my screen, since I found osg Widgets to be unreliable. Hope it's a good thing to implement my own navigation controls using textures as buttons and screenspace items? I didn't want to use MFC buttons coz my app would soon be ported to Linux. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48552#48552 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org