[osg-users] Is it possible to know when the node-graph is 'dirty'?

Peter Wraae Marino osghelp at gmail.com
Wed Jul 23 06:10:45 PDT 2008


Hi Viggo,

This is only a suggestion (you may have other reasons). To avoid the human
error as you called it, meaning that if someone forgets to call the reformat
code...
then you should have a method that 3rd party code/humans must use when
adding to your scene, for example

void CMySceneManagerThingy::AddToScene( osg::Node* pNode )
{
    // add to wherever you want the pNode to be added in the scene
    <code here>

    // reformat your scene as you want
    <code here>
}

on the other subject about rendering multitimes the same object.. you should
just create a new group and add your objects to that group
and the group to the scene (do this as many times as you want)..
don't know why you should be messing around with the renderbins? unless you
are trying somekind of render pass?

regards,
Peter
http://osghelp.com


On Wed, Jul 23, 2008 at 11:00 AM, Viggo Løvli <vigigio at hotmail.com> wrote:

> Hi Peter,
>
> What you say is true in most cases. The 'simplest' way to do this would be
> to tell my system that the node-tree need re-formatting each time we call
> OSG to add children. That would require two calls each time, and also requre
> humans to remember to implement both calls. This opens for human errors,
> which at least I dont want (I am lazy).
> I want to make my module (the one that need to format the node-masks)
> independent of the rest of the system, and to ensure that the rest of the
> system will not need to know about my module.
> I also want to be able to add 3rd party libraries to my application without
> re-writing them to do special calls to my module when they add nodes to the
> tree.
>
> So, the conclusion I have is that I need to automatically know when I need
> to format the node-masks.
>
> The osg::Group has a callback function named osg::Group::childInserted.
> I can make my root-node into a sub-class og osg::Group where I implement
> the childInserted function. This way I will get a callback each time someone
> add nodes to my root-node. If a module create it's own osg::Group and add
> children to it dymically then I would not know anything about that.
>
> I also saw Roberts reply and I agree that a dirty system on the node-tree
> would be very expensive. I knew that my question was a longshot.
>
> I am now thinking about other solutions to achieve my goal. The goal is to
> render the world with 3 slave cameras. One shall render all render-bins up
> to bin 9. One shall render bin 10. And the 3rd shall render bin 10 and up.
> So bin 10 is rendered twice. This is to fix some glitches on transparent
> polygons that intersect each other while needing to write to the
> depth-buffer.
>
> Ok, so another solution would be to force a camera to only render a certain
> number of bins.
> I have not seen any place in the code around camera or cull-settings that
> you can specify a camera to stay within a limited range of render-bins, so I
> guess this won't be as easy either?
>
> Do you have any suggestions on how to be able to render one bin twice in
> the same frame. The first and second render of the bin shall have a few
> render-states set differently.
>
> Regards,
> Viggo
>
>
>
>
>
> ------------------------------
>
> Date: Wed, 23 Jul 2008 07:58:37 +0200
> From: osghelp at gmail.com
> To: osg-users at lists.openscenegraph.org
> Subject: Re: [osg-users] Is it possible to know when the node-graph is
> 'dirty'?
>
>
>
>  Hi Viggo,
>
> Don't know the details of your code, but if you are adding a sub-node then
> you have code already that is called for adding the sub-node and
> thereby you know when the scene-graph has been modified?
>
> regards,
> Peter
> http://osghelp.com
>
>
>
> On Wed, Jul 23, 2008 at 7:51 AM, Viggo Løvli <vigigio at hotmail.com> wrote:
>
> Hi,
>
> My code is currently formatting the node-masks of the whole scene-graph
> before we start rendering. The formatting code is only ran once.
> If a sub-node is added to the node-tree afterwards then I want to run my
> formatting code again.
>
> Is there any way to know whether or not the scene-graph has been modified?
>
> Regards,
> Viggo
>
>
>
>
> ------------------------------
> Windows Live Hotmail på mobilen. Ha alltid e-posten din tilgjengelig.<http://windowslivemobile.msn.com/BrowserServiceHotmail.aspx?lang=nb-NO&ocid=30032>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
>
>
> --
> Regards,
> Peter Wraae Marino
>
> www.osghelp.com - OpenSceneGraph support site
>
>  ------------------------------
> Få Hotmail du også. Windows Live Hotmail nå med 5000 MB gratis
> lagringsplass.<http://clk.atdmt.com/GBL/go/msnnkdre0010000005gbl/direct/01/>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Regards,
Peter Wraae Marino

www.osghelp.com - OpenSceneGraph support site
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080723/3d23a25f/attachment-0003.htm>


More information about the osg-users mailing list