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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to