Hi Thomas,

The Viewer::checkNeedToDoFrame() looks correct, and CompositeViewer
one is missing the check for update callbacks in the scene graph.  I
have added the missing checks and checked this into svn/trunk.

This fix will break the behavior you looking for in your app though,
but it'll be correct as one can't assume that no frame is required if
there are update callbacks attached to the scene graph that require
frame to be called for.

Perhaps you have update callbacks on the scene graph that you don't
require, or perhaps your update callbacks aren't critical, however,
the OSG itself can't decide this and has to assume that if update
callbacks exist they have to be honoured.  However, there is nothing
stopping for you implementing your own viewer frame loop to run the
frame loop anyhow you see fit.

Robert.

On Mon, Oct 31, 2011 at 3:10 PM, Thomas Lerman <osgfo...@tevs.eu> wrote:
> CompositeViewer::checkNeedToDoFrame() does the following:
> Code:
>    if (_requestRedraw) return true;
>    if (_requestContinousUpdate) return true;
>
>    for(RefViews::iterator itr = _views.begin();
>        itr != _views.end();
>        ++itr)
>    {
>        osgViewer::View* view = itr->get();
>        if (view)
>        {
>            // If the database pager is going to update the scene the render 
> flag is
>            // set so that the updates show up
>            if (view->getDatabasePager()->requiresUpdateSceneGraph() ||
>                view->getDatabasePager()->getRequestsInProgress()) return true;
>        }
>    }
>
>    // now do a eventTraversal to see if any events might require a new frame.
>    eventTraversal();
>
>    if (_requestRedraw) return true;
>    if (_requestContinousUpdate) return true;
>
>    return false;
>
> and Viewer::checkNeedToDoFrame() does:
> Code:
>    if (_requestRedraw) return true;
>    if (_requestContinousUpdate) return true;
>
>
>    // If the database pager is going to update the scene the render flag is
>    // set so that the updates show up
>    if(getDatabasePager()->requiresUpdateSceneGraph() || 
> getDatabasePager()->getRequestsInProgress()) return true;
>
>    // if there update callbacks then we need to do frame.
>    if (_camera->getUpdateCallback()) return true;
>    if (getSceneData()!=0 && 
> getSceneData()->getNumChildrenRequiringUpdateTraversal()>0) return true;
>
>    // now do a eventTraversal to see if any events might require a new frame.
>    eventTraversal();
>
>    // now check if any of the event handles have prompted a redraw.
>    if (_requestRedraw) return true;
>    if (_requestContinousUpdate) return true;
>
>    return false;
>
> CompositeViewer works great in my case and calls frame() only when needed. 
> When I make the few changes required to use Viewer, it will always call 
> frame(). In my case, Viewer returns true because 
> getNumChildrenRequiringUpdateTraversal() == 2 and it never goes to 0. If I 
> manually set it to 0, everything works just fine. Am I doing something wrong? 
> It seems odd that the methods do not quite do the same thing. Should these 
> two methods be more consistent?[/code]
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=43645#43645
>
>
>
>
>
> _______________________________________________
> 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