[osg-users] cloned node without texture

Dieter Pfeffer dieter.pfeffer at nl.thalesgroup.com
Mon Jul 14 08:23:49 PDT 2008


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080714/18ce5786/attachment-0002.htm>


More information about the osg-users mailing list