Hi All,
I've tried several things, without achieving any improvement. The modified
geode always disappear from the rendered scene, but if I load it with
osgViewer.exe, it's properly rendered.

I'm sure I miss something related to the viewer frame loop and I have 2
questions:
1. Do we always need to call the update/rendering traversals in a scene when
we remove drawables from a geode and add new ones?
Shouldn't this be automatically taken in the scene rendering thread (if
any)?

2. If the above answer is yes (i.e. we always need to create and manage a
viewer frame loop), how could I have the frame loop updating the scene if my
geodes are modified before the scene update can be called, i.e. how can I
first modify the geode and afterword update the scene by calling the viewer
update/rendering traversals.

This is because I'm implementing a node/link editor that allows to create,
link and modify nodes and at any time I shall be able to update/refresh the
resulting scene viewer.

Thanks.
Fausto


On Fri, Jan 22, 2010 at 10:44 AM, fausto <f4us...@gmail.com> wrote:

> No, may be the problem is not there yet, unless I miss something.
>
> Never mind the following, I've been able to make it appear.
>
>
> > I've tried to call viewer->frame() when I know that the scene has been
> modified, but nothing appears now in the viewer.
>
> However the problem is still the same, even when I call viewer->frame()
> after having removed/added drawables from the geode.
> The new drawables don't appear in the viewer, while the old ones have
> properly disappeared.
>
> Fausto
>
>
>
> On Fri, Jan 22, 2010 at 10:25 AM, fausto <f4us...@gmail.com> wrote:
>
>> Hi JP,
>>
>>
>> > Does createGeom reuse any old osg data (arrays)?
>>
>> No.
>>
>>
>> > where in your frame loop do you do this?
>>
>> Well, now that you tell me, I think the problem is here. I have no loop. I
>> thought that the rendering refresh was done automatically when a node in the
>> scene was modified.
>> Sorry for my ignorance, this might seem stupid, but since I have very few
>> dynamic modifications in my scene, how can I simply refresh the viewer frame
>> without being obliged to have a loop.
>>
>> I've tried to call viewer->frame() when I know that the scene has been
>> modified, but nothing appears now in the viewer.
>>
>> Cheers.
>> Fausto
>>
>>
>>
>> On Fri, Jan 22, 2010 at 9:44 AM, J.P. Delport <jpdelp...@csir.co.za>wrote:
>>
>>> Hi,
>>>
>>>
>>> fausto wrote:
>>>
>>>> Hi JP,
>>>> it's impossible to show exactly my code, but what I basically do with
>>>> the geode is:
>>>>
>>>> 1. Remove all drawables:
>>>> geode->removeDrawables((unsigned int)0, geode->getNumDrawables());
>>>>
>>>> 2. Create new ones:
>>>> osg::ref_ptr< osg::Geometry > geom;
>>>> geom = createGeom(parameters);
>>>> ..
>>>>
>>>> 3. Add them to the geode:
>>>> if( geom.valid() ) geode->addDrawable( geom.get() );
>>>>
>>>
>>> I don't see anything strange. Does createGeom reuse any old osg data
>>> (arrays)? where in your frame loop do you do this? In between rendering
>>> calls (frame)? What happens if you just delete the geode and add a new one?
>>>
>>> jp
>>>
>>>
>>>> I'm not sure the problem is there, because as I mentioned the new scene
>>>> is properly shown if I load it with osgViewer.exe.
>>>>
>>>> I think the problem is more with some missing settings, either to the
>>>> drawables/nodes, or to the viewer (the original one, which doesn't get
>>>> updated). I tried to set the drawables data variance to DYNAMIC, and other
>>>> things but nothing worked. However, as Robert said, it seems this should
>>>> work without any additional action.
>>>>
>>>> The strange thing is, why the old drawables are properly deleted from
>>>> the original viewer, but the new ones are not added?
>>>> I would have preferred that the viewer didn't do anything, than just 1
>>>> part of the job.
>>>>
>>>> Thank you all for your prompt replies, I really appreciate it.
>>>> Fausto
>>>>
>>>>
>>>> On Fri, Jan 22, 2010 at 7:55 AM, J.P. Delport <jpdelp...@csir.co.za<mailto:
>>>> jpdelp...@csir.co.za>> wrote:
>>>>
>>>>    Hi,
>>>>
>>>>    can you give more detail on what you are adding/removing? Do you use
>>>>    the same vertex lists, but with new drawables. Do you change
>>>>    vertices, but keep the drawables? To get more help you'd probably
>>>>    need to make a very small example that shows the problem...
>>>>
>>>>    jp
>>>>
>>>>    fausto wrote:
>>>>
>>>>        Thank you both for your inputs.
>>>>
>>>>        To Robert:
>>>>
>>>>            Try writing the subgraph they are in out to a file then load
>>>>            this file
>>>>             into osgviewer to see if can view them.
>>>>
>>>>        Yes, as I mentioned the new scene data is OK, I can see it while
>>>>        debugging and after saving->loading it with osgViewer.exe all
>>>>        new drawables appear in the scene, and previous ones are
>>>>        removed. So, the scene is OK, the problem is really with the
>>>>        original viewer. It renders OK, but doesn't update properly when
>>>>        drawables are added.
>>>>
>>>>        I'm rendering in Qt widgets, could that be the problem?
>>>>
>>>>        To D.J.
>>>>
>>>>             I might recommend refactoring the code to
>>>>             add/remove nodes instead of drawables.
>>>>
>>>>        Unfortunately, I need nodes to be the same.
>>>>
>>>>        I keep searching and testing.  Thanks again for your help.
>>>>        Cheers.
>>>>        Fausto
>>>>
>>>>
>>>>        On Thu, Jan 21, 2010 at 6:42 PM, D.J. Caldwell
>>>>        <dlcaldwel...@gmail.com <mailto:dlcaldwel...@gmail.com>
>>>>        <mailto:dlcaldwel...@gmail.com <mailto:dlcaldwel...@gmail.com>>>
>>>>
>>>>        wrote:
>>>>
>>>>           Hi Fausto and Robert,
>>>>
>>>>           If the simple modification is due to some specific user event
>>>>        (button
>>>>           press, file dialog, etc.), I might recommend refactoring the
>>>>        code to
>>>>           add/remove nodes instead of drawables.  It sounds like you
>>>>        have no
>>>>           trouble initially getting the geometry into the scene; it is
>>>> the
>>>>           simple modification that is the problem.
>>>>
>>>>           What I am suggesting here is a work-around, and not a fix (on
>>>> my
>>>>           system, it appears that there is no "bug" to fix).  Other
>>>>        than this, I
>>>>           believe the issue may be familiarity with the available
>>>>        patterns; that
>>>>           is, using the right tool for the right job.  No insult
>>>>        intended, but
>>>>           the only fix for that is research, time, and patience.
>>>>
>>>>           The project I am part of uses visitors and/or swapping out
>>>>        vertices
>>>>           for time based changes, and adding/removing nodes for user
>>>> based
>>>>           inputs.
>>>>
>>>>           Fausto, as Robert said, you are the only one who can know what
>>>> is
>>>>           appropriate for your project.
>>>>
>>>>           Just some things to consider; I hope this helps...
>>>>
>>>>           D.J.
>>>>
>>>>           On Thu, Jan 21, 2010 at 12:12 PM, Robert Osfield
>>>>           <robert.osfi...@gmail.com <mailto:robert.osfi...@gmail.com>
>>>>        <mailto:robert.osfi...@gmail.com
>>>>        <mailto:robert.osfi...@gmail.com>>> wrote:
>>>>            > Hi Fausto,
>>>>            >
>>>>            > Dynamically modifying the scene graph shouldn't be that
>>>> hard.
>>>>            > Removing drawables and adding news ones should perfect
>>>>        safe and
>>>>            > shouldn't require and extra steps from you, no need to
>>>>        dirty bounding
>>>>            > volumes or display lists, it should all just work.
>>>>            >
>>>>            > As to why your new drawables aren't appearing I can't say.
>>>>         Try
>>>>            > writing the subgraph they are in out to a file then load
>>>>        this file
>>>>            > into osgviewer to see if can view them.  It could be
>>>>        simply that
>>>>           there
>>>>            > is something wrong with the geometry data you've set up.
>>>>  Only
>>>>           you has
>>>>            > your app and your data so you're the only one that can
>>>>        investigate.
>>>>            >
>>>>            > Robert.
>>>>            >
>>>>            > On Thu, Jan 21, 2010 at 4:41 PM, fausto <f4us...@gmail.com
>>>>        <mailto:f4us...@gmail.com>
>>>>           <mailto:f4us...@gmail.com <mailto:f4us...@gmail.com>>> wrote:
>>>>            >> Hi All,
>>>>            >> I'm struggling to have a simple modification of an osg
>>>> scene
>>>>           working.
>>>>            >> I simply need to remove all drawables from a geode and
>>>>        add new
>>>>           drawables to
>>>>            >> the same geode.
>>>>            >>
>>>>            >> In the viewer, the geode just disappears after removing
>>>> the
>>>>           drawables, but I
>>>>            >> can see that the scene contains the geode with the new
>>>>           drawables. So, it
>>>>            >> seems a rendering problem.
>>>>            >>
>>>>            >> I see that many people have similar problems with dynamic
>>>>           modifications.
>>>>            >> I've read plenty of posts about setting display list to
>>>>        false, using
>>>>            >> callbacks, dirtyBound(), etc....
>>>>            >>
>>>>            >> But I hope there is a clearer and easier way to achieve
>>>> this.
>>>>            >>
>>>>            >> Please let me know.
>>>>            >>
>>>>            >> Thanks for any help.
>>>>            >> Fausto
>>>>            >>
>>>>            >> _______________________________________________
>>>>            >> osg-users mailing list
>>>>            >> osg-users@lists.openscenegraph.org
>>>>        <mailto:osg-users@lists.openscenegraph.org>
>>>>           <mailto:osg-users@lists.openscenegraph.org
>>>>        <mailto:osg-users@lists.openscenegraph.org>>
>>>>
>>>>            >>
>>>>
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>            >>
>>>>            >>
>>>>            > _______________________________________________
>>>>            > osg-users mailing list
>>>>            > osg-users@lists.openscenegraph.org
>>>>        <mailto:osg-users@lists.openscenegraph.org>
>>>>           <mailto:osg-users@lists.openscenegraph.org
>>>>        <mailto:osg-users@lists.openscenegraph.org>>
>>>>
>>>>            >
>>>>
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>            >
>>>>           _______________________________________________
>>>>           osg-users mailing list
>>>>           osg-users@lists.openscenegraph.org
>>>>        <mailto:osg-users@lists.openscenegraph.org>
>>>>           <mailto:osg-users@lists.openscenegraph.org
>>>>        <mailto:osg-users@lists.openscenegraph.org>>
>>>>
>>>>
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>
>>>>
>>>>
>>>>
>>>>  ------------------------------------------------------------------------
>>>>
>>>>        _______________________________________________
>>>>        osg-users mailing list
>>>>        osg-users@lists.openscenegraph.org
>>>>        <mailto:osg-users@lists.openscenegraph.org>
>>>>
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>
>>>>
>>>>    --    This message is subject to the CSIR's copyright terms and
>>>>    conditions, e-mail legal notice, and implemented Open Document
>>>>    Format (ODF) standard. The full disclaimer details can be found at
>>>>    http://www.csir.co.za/disclaimer.html.
>>>>
>>>>    This message has been scanned for viruses and dangerous content by
>>>>    MailScanner, and is believed to be clean.  MailScanner thanks
>>>>    Transtec Computers for their support.
>>>>
>>>>    _______________________________________________
>>>>    osg-users mailing list
>>>>    osg-users@lists.openscenegraph.org
>>>>    <mailto: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
>>>>
>>>
>>> --
>>> This message is subject to the CSIR's copyright terms and conditions,
>>> e-mail legal notice, and implemented Open Document Format (ODF) standard.
>>> The full disclaimer details can be found at
>>> http://www.csir.co.za/disclaimer.html.
>>>
>>> This message has been scanned for viruses and dangerous content by
>>> MailScanner, and is believed to be clean.  MailScanner thanks Transtec
>>> Computers for their support.
>>>
>>> _______________________________________________
>>> 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

Reply via email to