Because in the osg implementation (that I have anyway), it looks like
the parent of the node is used for setting the state. This seems to be
true in my experimenting. If I just applied the state change to the
node I wanted affected by the state change, it did not seem to work.

void RenderLeaf::render(State& state,RenderLeaf* previous)
{
    // don't draw this leaf if the abort rendering flag has been set.
    if (state.getAbortRendering())
    {
        //cout << "early abort"<<endl;
        return;
    }

    if (previous)
    {

        // apply matrices if required.
        state.applyProjectionMatrix(_projection.get());
        state.applyModelViewMatrix(_modelview.get());

        // apply state if required.
        RenderGraph* prev_rg = previous->_parent;
        RenderGraph* prev_rg_parent = prev_rg->_parent;
        RenderGraph* rg = _parent;
        if (prev_rg_parent!=rg->_parent)
        {
            RenderGraph::moveRenderGraph(state,prev_rg_parent,rg-
>_parent);

            // send state changes and matrix changes to OpenGL.
            state.apply(rg->_stateset);

        }

On Apr 15, 3:07 pm, "Thrall, Bryan" <[EMAIL PROTECTED]>
wrote:
> Judie wrote on Tuesday, April 15, 2008 4:58 PM:
>
> > I had to add in some buffer group nodes ahead of the ones I wanted to
> > apply a state change to and so now it works great.
>
> Out of curiosity, why couldn't you just add the state change to NodeC instead 
> of adding buffer group nodes?
>
>
>
>
>
> > On Apr 14, 11:54 am, "Robert Osfield" <[EMAIL PROTECTED]>
> > wrote:
> >> What you are trying to do should work, but without the code for
> >> setting the
> >> different stateset to the appropriate nodes I can't say what exactly
> >> the
> >> problem is.  The fact that you refer to NodeCParent  looks suspect,
> >> you
> >> should apply directly to NodeC as NodeCParent is NodeA...
>
> >> On Mon, Apr 14, 2008 at 7:36 PM, Judie Stanley
> >> <[EMAIL PROTECTED]>
> >> wrote:
>
> >>> This is an exisiting project.
> >>> Here is the basic node structure:
>
> >>>                     Root
> >>>                        |
> >>>                     NodeA
> >>>                      /       \
> >>>              NodeB     NodeC
>
> >>> I want to disable writes to the color buffer before Node A, and
> >>> then I don't want to enable them until Node C. That way, Node A,
> >>> and Node B are drawn but only the depth buffer is updated, but then
> >>> when Node C is drawn, both the color buffer and the depth buffer
> >>> are updated.
>
> --
> Bryan Thrall
> FlightSafety International
> [EMAIL PROTECTED]
> _______________________________________________
> osg-users mailing list
> [EMAIL 
> PROTECTED]://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph...-
>  Hide quoted text -
>
> - Show quoted text -
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to