Hi
I am trying to attach a cloned node to the scene when I press a key (source
code below)- I can see the geometry but no texture. I have implemented it in
the osgViewer example.
When I put this source directly into the viewer source, it works.
I am using osg 2.3.6, Windows XP.
Any hints ?
Thanks
Dieter
extern osg::ref_ptr<osg::Group> scene;
extern osg::ref_ptr<osg::Node> l_node ;
bool myKeyboard::handle(const osgGA::GUIEventAdapter&
ea,osgGA::GUIActionAdapter& )
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (ea.getKey()=='y')
{
osg::ref_ptr<osg::Node> new_node =
dynamic_cast<osg::Node*>(l_node->clone(osg::CopyOp::DEEP_COPY_ALL));
osg::MatrixTransform* positioned = new osg::MatrixTransform;
positioned->setMatrix( osg::Matrix::translate(osg::Vec3 (10.,0.,10.)));
positioned->addChild(new_node.get());
osg::PositionAttitudeTransform* objXform = new
osg::PositionAttitudeTransform;
objXform->addChild(positioned);
scene.get()->addChild (objXform);
//osgUtil::Optimizer optimizer;
//optimizer.optimize(scene.get());
return true;
}
return false;
}
Unclassified Mail
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org