[osg-users] what's wrong with removechild

2015-07-24 Thread LUO Jianguo
Hi,

I want to pick one node using mouse. then the node deleted. but I failed. I 
don't know why. the nodepick.h attached.

the osg::Node* pNode can be picked. and it can be changed to red.

but the following mViewer-getSceneData()-asGroup()-removeChild(pNode); 
failed. 

I also used m_Rt-removeChild(pNode); failed again. 

So puzzled. help me plz.


Thank you!

Cheers,
LUO

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64470#64470




Attachments: 
http://forum.openscenegraph.org//files/nodepick_135.h


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] I created 10000 cylinder, osg run very slow

2015-07-24 Thread LUO Jianguo
Yeah, it's not ladder. It's cable tray in the power plant. . In fact, I used 
not more than 1000 cylinders, osg runs very slow. I ignore the cylinders, it 
gets much faster.

then I have to disable shadow,
osg::ref_ptrosgShadow::SoftShadowMap  ssm = new osgShadow::SoftShadowMap;
//  float bias = ssm-getBias();
//  ssm-setBias(bias*2.0);
//  mShadowedSceneRoot-setShadowTechnique(ssm.get());
//  
mShadowedSceneRoot-setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
//  
mShadowedSceneRoot-setCastsShadowTraversalMask(CastsShadowTraversalMask);

the program runs fast again.

So I enable shadow again, and disable the cylinders // 
setNodeMask(CastsShadowTraversalMask);
the program still slow.

Maybe I can't draw my power plant prefectly, without shadow.

And would you please answer my another question in the other article, it's 
still about the power plant. thanks.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64464#64464




Attachments: 
http://forum.openscenegraph.org//files/cabletray_292.jpg


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] How to delete Node from the root

2015-07-24 Thread LUO Jianguo
Hi,

I use addchild to create root tree.
Yeah, we can use removechild to pruning. But the removed node is still in the 
memory.
I wonder how i can delete it totally from the memory.
We can get any node using computeIntersections(x,y,intersections).
We got the osg::Node *node, then free(node), the node is null. but we new many 
kinds of objects when new node, e.g., osg::Image image, osg::Texture2D 
texture, osg::ShapeDrawable doorShape and so on.
how can i delete these pointers. 
Need I create free function for each node?
 
Thank you!

Cheers,
LUO

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64465#64465





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] I created 10000 cylinder, osg run very slow

2015-07-22 Thread LUO Jianguo
Hi,

I need to use cylinder to simulate the “ladder”.  So there are many cylinder to 
create. I new a osg::Geode , and then use it to new 1 osg::MatrixTransform, 
all these osg::MatrixTransform were added to one group. 

But the program runs very very slow.
In fact I create the same scene using opengl, the program runs quickly.

How can I upgrade my program? 
thanks.

Thank you!

Cheers,
LUO

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64386#64386




Attachments: 
http://forum.openscenegraph.org//files/mfc_osg_124.cpp


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org