Make sure your protect your mode :

*state->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF|**
osg::StateAttribute::PROTECTED|osg::StateAttribute::OVERRIDE**);*

On Fri, Jan 9, 2009 at 10:57 AM, Vincent Bourdier <
vincent.bourd...@gmail.com> wrote:

> Hi,
>
> Thanks for your explanations.
>
> If anyone can explain me the Depth class and the binName string , I would
> be very grateful.
>
> For now, I've tried this :
>
> *void setNodeAlwaysRendered(osg::Node* n)
> {
>     if(!n) return;
>
>     osg::ref_ptr<osg::StateSet> state = n->getOrCreateStateSet();
>
>     //no scene graph culling
>     n->setCullingActive(false);
>
>     //set depht test off
>     state->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
>
>     //last rendered
>     state->setRenderBinDetails(INT_MAX, "RenderBin");
> }*
>
> But nothing changed... I apply it on a PAT, and on a geode ... but the node
> it still culled by the other one... I use HUDs in the scene, but the scene
> graph is not attached to them... so I don't think it can explain that.
>
> Is there some properties to check on the View ? compositeViewer ? camera ?
>
> Can I apply that on every king of node ? is there a mean to force children
> inherit the state ? is it necessary ?
>
> Thanks for you help.
>
> Regards,
>    Vincent.
>
> 2009/1/9 Serge Lages <serge.la...@gmail.com>
>
>> Hi Vincent,
>>
>> I'll try to answer to your questions...
>>
>> On Fri, Jan 9, 2009 at 9:55 AM, Vincent Bourdier <
>> vincent.bourd...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I need some explanations about the ways OSG allow to modify the render.
>>>
>>> I am working on a function, to apply to a node, to set it always rendered
>>> over the other nodes. In other words, If I apply this on an osgText, I would
>>> be able to read the text whatever my camera position can be (of course if
>>> text is in the frustum).
>>>
>>> I make some search and I found a lot of things:
>>>
>>>  * node->setCullingActive() : disable/enable the culling on a node. I am
>>> I good, disabling this on a node is not sufficient, after that we need to
>>> tell the node when to be rendered, isn't it ?
>>>
>>
>> You don't necessarily need to disable the culling to be sure to see your
>> node. The culling is applied depending on the view frustum or the distance
>> (small feature culling). And you're right, it's not sufficient to disable
>> it.
>>
>>
>>>
>>>  * state->setMode(GL_DEPTH_TEST, OFF) : same thing ? what is the
>>> difference with the first one ? just OSG/OpenGl distinction ?
>>>
>>
>> This one disable depth tests with the other nodes, which means that when
>> you'll render your node, OpenGL will not check if your object is behind
>> another one, it will render your node on top of everything rendered so far.
>>
>> It's a first step to be sure to see your node, so don't forget to set the
>> GL_DEPTH_TEST to off.
>>
>>
>>>
>>>  * state->setRenderbinDetails(binNum, binName) : num < 0 will be first
>>> rendered, num >0 will be the last ? what is the binName ? I saw
>>> "LastRenderBin" or "RenderBin" ... is there some keyword or it is just a
>>> name ? what is this word function ?
>>>
>>
>> RenderBins allows you to control the rendering order of your node, I must
>> admit that it's a complex topic I don't still fully understand. But what you
>> need to know is that if you set something like that :
>>
>> state->setRenderbinDetails(INT_MAX, "RenderBin") ;
>>
>> You'll be pretty sure to have your object rendered last. In combination
>> with the GL_DEPTH_TEST, you've got your reciepe to get an object always
>> rendered.
>>
>> But be aware to not have an other osg::Camera rendering after the one
>> where your object is attached. In this case, be sure that you render your
>> object with the last osg::Camera rendered in your scene.
>>
>> Hope this helps !
>>
>> --
>> Serge Lages
>> http://www.tharsis-software.com
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Serge Lages
http://www.tharsis-software.com
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to