To NOT render a node and all its children simply set is Node mask to 0x0
to stop it being drawn, and set it 0xFFFFFFF and any value that results
in true when locial AND'ed cameras mask

As to alsway being drawn

1) Turn OSG culling of on the node

2) Place the node and its children in a render bin with a high number
like 100 or higher than any other you may be using.
This will make sure it is rendered last
node->setRenderBinDetails( 100,"LastRenderBin");

3) If you want all of the geometry to be drawn then turn OFF the depth
test of for  node and its children as shown below


Gordon

__________________________________________________________
Gordon Tomlinson

Product Manager 3D
Email  : gtomlinson @ overwatch.textron.com
__________________________________________________________
(C): (+1) 571-265-2612
(W): (+1) 703-437-7651

"Self defence is not a function of learning tricks 
but is a function of how quickly and intensely one 
can arouse one's instinct for survival" 
- Master Tambo Tetsura

 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ulrich
Hertlein
Sent: Wednesday, December 03, 2008 12:53 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Depth/Cull question

Hi Vincent,

Quoting Vincent Bourdier <[EMAIL PROTECTED]>:
> I just need to set a node to be always rendered (or not).
> It needs to not depend on the Zbuffer/culling.
>...
> *osg::ref_ptr<osg::StateSet> state = node->getOrCreateStateSet();*
> > *        state->setMode(GL_CULL_FACE, osg::StateAttribute::ON);*
> > *        osg::ref_ptr<osg::Depth> depth;*
> > *        if(set){*
> > *            depth = new osg::Depth(osg::Depth::ALWAYS, 0.0, 1.0);*
> > *            state->setMode(GL_CULL_FACE,
osg::StateAttribute::OFF);*
> > *            node->setCullingActive(false);*
> > *        }else{*
> > *            depth = new osg::Depth(osg::Depth::LEQUAL, 0.0, 1.0);*
> > *            state->setMode(GL_CULL_FACE, osg::StateAttribute::ON);*
> > *            node->setCullingActive(true);*
> > *        }*
> > *            *
> > *        state->setAttributeAndModes(depth.get(),
> > osg::StateAttribute::ON);*

Seems to me you're actually throwing different concepts into one bag:
- Zbuffer/depth test
- GL face culling
- OSG node culling

If I understand you correctly then you want to make sure a node is
always drawn irrespective of any objects that might be in front of it.
Simply turn of the depth test:
state->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF)

That might expose issues with the order in which objects are drawn - the
solution to that is RenderBins.

When you say "always rendered *(or not)*" (my emphasis) do you want to
turn it off completely?

Hope this helps,
Cheers,
/ulrich
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to