[osg-users] cloned node without texture

Dieter Pfeffer dieter.pfeffer at nl.thalesgroup.com
Mon Jul 14 10:16:06 PDT 2008


Hi

it seems that for my purpose -
clone(osg::CopyOp::DEEP_COPY_NODES);

is the best one (geometry and texture)



DIeter




  -----Original Message-----
  From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org]On Behalf Of Dieter
Pfeffer
  Sent: Monday, 14 July, 2008 17:24
  To: osg-users at lists.openscenegraph.org
  Subject: [osg-users] cloned node without texture


  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/c6366041/attachment-0003.htm>


More information about the osg-users mailing list