I've been doing that by adding a cull callback to the node I want invisible
like so:
Struct AlwaysCullDrawable : public osg::Drawable::CullCallback
{
/** do customized cull code.*/
virtual bool cull(osg::NodeVisitor*, osg::Drawable* drawable,
osg::State* /*state*/) const
{
return true;
}
};
collisionGeode->setCullCallback(new AlwaysCullDrawable());
Alistair Baxter
Software Engineer
________________________________
Our next public training event is in Houston, USA on 20th - 22nd August 2013
For further information please visit www.mve.com/calendar
Midland Valley Exploration Ltd.
144 West George Street
Glasgow G2 2HG
United Kingdom
Tel: +44 (0) 141 332 2681
Fax: +44 (0) 141 332 6792
The structural geology experts
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Dario Minieri
Sent: 20 August 2013 14:36
To: [email protected]
Subject: [osg-users] Make object totally transparent, but not hide :D
Hi,
Sorry for noob question, but I need to make an object totally transparent (as
invisible) but I have to maintain your "presence" in the world (the object
can't be masked). This means that the object isn't visible but all collisions
and others interactions in the world have to work.
I can make the transparency using code like this, but the object isn't never
really "invisible":
Code:
osg::Material* l_material =
(osg::Material*)p_Object->getStateSet()>getAttribute(osg::StateAttribute::MATERIAL);
l_material->setTransparency(p_face_mode, 1-p_transparency);
p_Object->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON);
p_Object->getOrCreateStateSet()->setAttributeAndModes(l_material,
osg::StateAttribute::OVERRIDE);
Where p_face_mode is FRONT_AND_BACK for example.
Thank you!
Cheers,
Dario
Code:
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=55902#55902
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org