HI Evan et. al,

On Thu, Apr 23, 2009 at 5:16 PM, Robert Osfield
<[email protected]> wrote:
> Tweaking the
> application code so that it doesn't do an viewer.advance() until a new
> frame is actually required.

I've now tried this and got the viewer supplied by Evan to do lazy
updating of the graphics to work without the paging out problem.  I
simply refactored the custom frame() a little so that it just does the
eventTraversal() when no rendering so the frame count never goes up,
it only does a full frame when there is need to.  The code is below:

> It's also worth noting that there is a potential bug in the supplied
> viewer that does lazy update - it only will ever work if the pager
> isn't doing precompile, if it does do precompile then you have to
> render frames to enable the pager to get it's GL objects compiled,
> otherwise the pager will just go to sleep waiting for the objects to
> be compiled by the rendering thread(s), then you'd have stale mate.
> A possible way to solve this would be to check the DatabasePager to
> see if it has any database requests that are still active, and keeping
> rendering while it does.

This was simple to solve, I simply added an additional  check of
getDatabasePager()->getRequestsInProgress() in the test whether to
render the frame or not.  I've added this into my version of Evan's
test viewer, code is part of the code fragment at the bottom of this
email.

Now I have a viewer level solution for this problem, is a
DatabasePager level solution required?   Added such supported to
DatabasePager is possible by it'd complicate it, and it would change
it's ABI so isn't something we can role into the 2.8.x series without
breaking binary compatibility.  Given this issue isn't actual a bug in
the DatabasePager, but an issue with it being used out of it's
designed usage I thinking it's probably appropriate to view any
expansion of the usage models it's support as an added feature and
therefore something would go into svn/trunk + 2.9.x.

I have some other thoughts too on this issue that I'll leave for a
follow up email.

Robert.

-- Custom frame that works with lazy updating of the frame.

    virtual void frame(double simulationTime=USE_REFERENCE_TIME)
    {
        if (_done) return;

        if (_firstFrame)
        {
            viewerInit();

            if (!isRealized())
            {
                realize();
            }

            _firstFrame = false;
        }

        if (!needsRender && !continuousUpdate)
        {
            eventTraversal();

            // 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())
                needsRender = true;
        }

        if(needsRender || continuousUpdate)
        {
            advance(simulationTime);

            eventTraversal();

            // 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())
                needsRender = true;

            updateTraversal();

            renderingTraversals();
            needsRender = false;
        }
    }
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to