Re: [osg-users] DBPager continuously reloading tiles

2009-04-24 Thread Robert Osfield
Hi JS,

On Thu, Apr 23, 2009 at 7:27 PM, Jean-Sébastien Guay
jean-sebastien.g...@cm-labs.com wrote:
 As an additional data point, on Windows, the NVidia drivers ship with vsync
 enabled by default, but ATI ships with it disabled. This always bugs me when
 setting up a new machine.

Thanks for the info.

 If you want to add a feature for capping the frame rate, then I'd like to
 suggest having a key, a command-line arg and an environment variable to
 enable/disable this, and perhaps a way of setting the target frame rate.
 Personally I prefer letting users have the choice, through the vsync setting
 in their driver, whether they want to cap the frame rate or not.

It's only be the run convenience method that would do the frame rate
management, and perhaps we could expose a viewer method to help the
frame management done in user code.  With the frame rate management my
expectation would be offer a couple of different settings so that
calling code could choose how that want to run the frame management,
be it lazy frame loop, continuous but capped to be at or below a
specified max frame rate, or free running where the frame rate run
just at full pelt only help back by vsynvc (if enabled).

We could possible provide an env var to provide a hint to
DisplaySettings for what the defaults should be.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-24 Thread Jean-Sébastien Guay

Hi Robert,


We could possible provide an env var to provide a hint to
DisplaySettings for what the defaults should be.


Yes, that would be nice.

As a related point, in Vortex we have a frame lock which will sleep a 
given number of milliseconds at the end of the post-update phase before 
starting the next frame. The amount of time it sleeps is dictated by a 
given frame rate, i.e. if the time taken by the pre-update, update, 
post-update phases was less than say 1/60th of a second then it sleeps 
for the remaining time. This can be disabled at any time, and the 
physics work whether it's on or not, it's just to give a consistent user 
experience whether vsync is on or off. From what you've said you want to 
do something similar.


So then, we'd have three frame-rate control mechanisms: vsync, OSG's 
mechanism and Vortex's mechanism. So you see why I'd want a way to 
disable the one in OSG easily (since we have more control over the one 
in Vortex to make sure it does exactly what we want).


Also, I've always been suspicious of this kind of scheme when related to 
vsync. What if both vsync and the frame-rate control scheme in OSG are 
turned on, but the frames finish rendering in between vsync cycles. 
Won't that introduce tearing? We'd have to synchronize the end of OSG 
frame rendering with the vsync so that the swap occurs at the right 
time, wouldn't we? (this is a question I have about our own scheme too, 
I haven't had the chance to look into how it's done that much)


Anyways, just curious.

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-24 Thread Robert Osfield
Hi JS,

On Fri, Apr 24, 2009 at 2:37 PM, Jean-Sébastien Guay
jean-sebastien.g...@cm-labs.com wrote:
 As a related point, in Vortex we have a frame lock which will sleep a given
 number of milliseconds at the end of the post-update phase before starting
 the next frame. The amount of time it sleeps is dictated by a given frame
 rate, i.e. if the time taken by the pre-update, update, post-update phases
 was less than say 1/60th of a second then it sleeps for the remaining time.
 This can be disabled at any time, and the physics work whether it's on or
 not, it's just to give a consistent user experience whether vsync is on or
 off. From what you've said you want to do something similar.


The frame scheme I'm working on right now only affect Viewer::run(),
and you'll be able to switch it on/off as well.  So if you don't use
Viewer::run() then you won't get this facility, and even if you do use
run then you'll be able to control the whether or not it does cap the
frame rate.

 So then, we'd have three frame-rate control mechanisms: vsync, OSG's
 mechanism and Vortex's mechanism. So you see why I'd want a way to disable
 the one in OSG easily (since we have more control over the one in Vortex to
 make sure it does exactly what we want).

 Also, I've always been suspicious of this kind of scheme when related to
 vsync. What if both vsync and the frame-rate control scheme in OSG are
 turned on, but the frames finish rendering in between vsync cycles. Won't
 that introduce tearing? We'd have to synchronize the end of OSG frame
 rendering with the vsync so that the swap occurs at the right time, wouldn't
 we? (this is a question I have about our own scheme too, I haven't had the
 chance to look into how it's done that much)

If vsync is on then the OSG side frame capping won't affect this, it
won't cause tearing.  The OSG frame rate capping might cause you to
loose a frame occasionally though as the microSleep timing code is not
perfectly accurate.   The frame rate capping can be turned off so if
you have vysnc on this may well be what you'd want to do.  I'm still
playing with the implementation + API.  More info once I have
something concrete to share.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-24 Thread Jean-Sébastien Guay

Hi Robert,


The frame scheme I'm working on right now only affect Viewer::run(),
and you'll be able to switch it on/off as well.  So if you don't use
Viewer::run() then you won't get this facility, and even if you do use
run then you'll be able to control the whether or not it does cap the
frame rate.


OK, good to know. So it's for convenience but will not impede 
applications that are already doing something more involved than 
Viewer::run(). That's great.



If vsync is on then the OSG side frame capping won't affect this, it
won't cause tearing.  The OSG frame rate capping might cause you to
loose a frame occasionally though as the microSleep timing code is not
perfectly accurate.


Great, that's fine.


The frame rate capping can be turned off so if
you have vysnc on this may well be what you'd want to do.  I'm still
playing with the implementation + API.  More info once I have
something concrete to share.


OK, looking forward to it.

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-23 Thread Robert Osfield
Hi Evan,

On Wed, Apr 22, 2009 at 10:05 PM, Evan Andersen andersen.e...@gmail.com wrote:
 Ryan,

 Thank you for the suggestion.  When I call
 setTargetMaximumNumberOfPagedLOD(0) on the database pager, as you suggested
 and then set the expiry delay to DBL_MAX and the expiry frames to 10, as
 Jason Suggested the problem seems to go away.  I'm not really sure why this
 works.  It seems like the default behavior should work in my usage case, but
 at least it is working now.

Could you modify one of the OSG examples to reproduce your application
usage style and use this to recreate the problem.  I could then have a
look at why the new (and now default) expiry scheme is not working
correctly.  As you say it should work, at present I don't know why the
old scheme is able to work.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-23 Thread Evan Andersen
Robert,

Here's a simple viewer I wrote that does non-continuous render and exhibits
the problem.  You can just run it like the osgviewer application, passing in
the path to a database on the command line.  I have also included a stats
handler that will cause the app to switch to continuous render while it is
onscreen.  I have only tested this with osgEarth, so I don't know if the
problem manifests itself with VPB databases.  The reloading problem wouldn't
manifest itself when I ran an animation path because playing back the
animation essentially caused continuous rendering, but if you load an earth
database and move around a bit in the scene you should see the behavior.  I
can get it to happen pretty reliably when I load the yahoo satellite images
using osgEarth, then quickly zoom in on an area that I have cached.  When I
stop zooming and zoom back out or pan around, the tiles start reloading.  I
had a co-worker try this out and he was able to duplicate the problem pretty
quickly, so hopefully it will happen easily for you too.

Evan


On Thu, Apr 23, 2009 at 2:14 AM, Robert Osfield robert.osfi...@gmail.comwrote:

 Hi Evan,

 On Wed, Apr 22, 2009 at 10:05 PM, Evan Andersen andersen.e...@gmail.com
 wrote:
  Ryan,
 
  Thank you for the suggestion.  When I call
  setTargetMaximumNumberOfPagedLOD(0) on the database pager, as you
 suggested
  and then set the expiry delay to DBL_MAX and the expiry frames to 10, as
  Jason Suggested the problem seems to go away.  I'm not really sure why
 this
  works.  It seems like the default behavior should work in my usage case,
 but
  at least it is working now.

 Could you modify one of the OSG examples to reproduce your application
 usage style and use this to recreate the problem.  I could then have a
 look at why the new (and now default) expiry scheme is not working
 correctly.  As you say it should work, at present I don't know why the
 old scheme is able to work.

 Robert.
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


#include osgViewer/viewer
#include osgDB/ReadFile
#include osgViewer/ViewerEventHandlers

#include osgGA/TrackballManipulator
#include osgGA/FlightManipulator
#include osgGA/DriveManipulator
#include osgGA/KeySwitchMatrixManipulator
#include osgGA/StateSetManipulator
#include osgGA/TerrainManipulator

#include OpenThreads/Thread
#include cfloat

// The stats handler has to be modified to request continuous updates
// when stats are being displayed
class MyStats : public osgViewer::StatsHandler
{
protected:
~MyStats() {}
int keyPresses;
public:
MyStats() : osgViewer::StatsHandler(), keyPresses(0) {}
virtual bool handle(const osgGA::GUIEventAdapter ea, 
osgGA::GUIActionAdapter aa)
{
if( ea.getEventType() != osgGA::GUIEventAdapter::KEYDOWN )
return false;

int key = ea.getKey();

if(key == -1)
return false;

if(key == 's') {
if(keyPresses  4)
{
aa.requestContinuousUpdate(true);
keyPresses++;
}
else
{
keyPresses = 0;
aa.requestContinuousUpdate(false);
aa.requestRedraw();
}

return osgViewer::StatsHandler::handle(ea, aa);
}
return false;
}
};

class MyViewer : public osgViewer::Viewer
{
public:
MyViewer() : osgViewer::Viewer(), needsRender(true), 
continuousUpdate(false) {}
MyViewer(osg::ArgumentParser arguments) : osgViewer::Viewer(arguments), 
needsRender(true), continuousUpdate(false) {}

virtual void requestRedraw()
{
needsRender = true;
}

virtual void requestContinuousUpdate(bool needed=true)
{
continuousUpdate = needed;
}

virtual int run()
{
// From osgViewer::Viewer
if (!getCameraManipulator()  getCamera()-getAllowEventFocus())
{
setCameraManipulator(new osgGA::TrackballManipulator);
}

setReleaseContextAtEndOfFrameHint(false);

// From osgViewer::ViewerBase
if (!isRealized())
{
realize();
}

/***/
// This block of code seems to fix the reloading problems
//getDatabasePager()-setTargetMaximumNumberOfPageLOD(0);
//getDatabasePager()-setExpiryDelay(DBL_MAX);
//getDatabasePager()-setExpiryFrames(10);
/**/

while (!done())
{
frame();

// Sleep for 10 miliseconds.  This is just an arbitrary value, but 
we'd
// do something intelligent to make the loop run at a desired rate.
OpenThreads::Thread::microSleep(1);
}

return 0;
}

virtual void frame(double 

Re: [osg-users] DBPager continuously reloading tiles

2009-04-23 Thread Kawicki, Ryan H
Though I do not believe this problem to be limited to a particular
application, we are seeing this problem with our terrapage databases
produced through Terra Vista.
 
I'll try and see if our database group can produce a dataset that
exhibits this problem and can be released to the community with no
problems.

Ryan H. Kawicki 
The Boeing Company 
Training Systems  Services 
Software Engineer 
Phone: (314) 777-1654 

 




From: Evan Andersen [mailto:andersen.e...@gmail.com] 
Sent: Thursday, April 23, 2009 10:09 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] DBPager continuously reloading tiles


Robert,

Here's a simple viewer I wrote that does non-continuous render
and exhibits the problem.  You can just run it like the osgviewer
application, passing in the path to a database on the command line.  I
have also included a stats handler that will cause the app to switch to
continuous render while it is onscreen.  I have only tested this with
osgEarth, so I don't know if the problem manifests itself with VPB
databases.  The reloading problem wouldn't manifest itself when I ran an
animation path because playing back the animation essentially caused
continuous rendering, but if you load an earth database and move around
a bit in the scene you should see the behavior.  I can get it to happen
pretty reliably when I load the yahoo satellite images using osgEarth,
then quickly zoom in on an area that I have cached.  When I stop zooming
and zoom back out or pan around, the tiles start reloading.  I had a
co-worker try this out and he was able to duplicate the problem pretty
quickly, so hopefully it will happen easily for you too.

Evan



On Thu, Apr 23, 2009 at 2:14 AM, Robert Osfield
robert.osfi...@gmail.com wrote:


Hi Evan,


On Wed, Apr 22, 2009 at 10:05 PM, Evan Andersen
andersen.e...@gmail.com wrote:
 Ryan,

 Thank you for the suggestion.  When I call
 setTargetMaximumNumberOfPagedLOD(0) on the database
pager, as you suggested
 and then set the expiry delay to DBL_MAX and the
expiry frames to 10, as
 Jason Suggested the problem seems to go away.  I'm not
really sure why this
 works.  It seems like the default behavior should work
in my usage case, but
 at least it is working now.


Could you modify one of the OSG examples to reproduce
your application
usage style and use this to recreate the problem.  I
could then have a
look at why the new (and now default) expiry scheme is
not working
correctly.  As you say it should work, at present I
don't know why the
old scheme is able to work.


Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-23 Thread Robert Osfield
Thanks Evan, with your example I'm able to see the problem when
browsing http://www.openscenegraph.org/data/earth_bayarea/earth.ive.
I'll now dig into the DatabasePager to see what is up.

On Thu, Apr 23, 2009 at 4:08 PM, Evan Andersen andersen.e...@gmail.com wrote:
 Robert,

 Here's a simple viewer I wrote that does non-continuous render and exhibits
 the problem.  You can just run it like the osgviewer application, passing in
 the path to a database on the command line.  I have also included a stats
 handler that will cause the app to switch to continuous render while it is
 onscreen.  I have only tested this with osgEarth, so I don't know if the
 problem manifests itself with VPB databases.  The reloading problem wouldn't
 manifest itself when I ran an animation path because playing back the
 animation essentially caused continuous rendering, but if you load an earth
 database and move around a bit in the scene you should see the behavior.  I
 can get it to happen pretty reliably when I load the yahoo satellite images
 using osgEarth, then quickly zoom in on an area that I have cached.  When I
 stop zooming and zoom back out or pan around, the tiles start reloading.  I
 had a co-worker try this out and he was able to duplicate the problem pretty
 quickly, so hopefully it will happen easily for you too.

 Evan


 On Thu, Apr 23, 2009 at 2:14 AM, Robert Osfield robert.osfi...@gmail.com
 wrote:

 Hi Evan,

 On Wed, Apr 22, 2009 at 10:05 PM, Evan Andersen andersen.e...@gmail.com
 wrote:
  Ryan,
 
  Thank you for the suggestion.  When I call
  setTargetMaximumNumberOfPagedLOD(0) on the database pager, as you
  suggested
  and then set the expiry delay to DBL_MAX and the expiry frames to 10, as
  Jason Suggested the problem seems to go away.  I'm not really sure why
  this
  works.  It seems like the default behavior should work in my usage case,
  but
  at least it is working now.

 Could you modify one of the OSG examples to reproduce your application
 usage style and use this to recreate the problem.  I could then have a
 look at why the new (and now default) expiry scheme is not working
 correctly.  As you say it should work, at present I don't know why the
 old scheme is able to work.

 Robert.
 ___
 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


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-23 Thread Robert Osfield
On Thu, Apr 23, 2009 at 4:32 PM, Robert Osfield
robert.osfi...@gmail.com wrote:
 Thanks Evan, with your example I'm able to see the problem when
 browsing http://www.openscenegraph.org/data/earth_bayarea/earth.ive.
 I'll now dig into the DatabasePager to see what is up.

The culprit looks to be the following (normally valid) code in
DatabasePager::capped_removeExpiredSubgraphs(const osg::FrameStamp
frameStamp):

int delta = frameStamp.getFrameNumber() -
plod-getFrameNumberOfLastTraversal();
if (delta1)
{
if (_releaseDelay!=DBL_MAX)
{
plod-releaseGLObjects();

osg::notify(osg::NOTICE)DatabasePager::removeExpiredSubgraphs(),
releasing gl objectsstd::endl;
}

_inactivePagedLODList.push_back(plod);

itr = _activePagedLODList.erase(itr);
}


The only reason why this is a problem in this particular usage case is
that you have a viewer that is continue to increment the frame count
so the  frameStamp.getFrameNumber() keeps getting incremented, but
since the scene isn't being rendering the
plod-getFrameNumberOfLastTraversal() is not updating so the frame
delta becomes  1 and the PagedLOD gets assigned as expired.

The code in DatabasePager is correct for how the pager + PagedLOD were
designed to be used.  The problem is that code is now being used in
way that is wasn't originally intended.  Updating the frame count and
not rendering is the problem.  Not updating the frame count and not
rendering would work, as does updating the frame count and rendering.

The next question is how to either get the viewer or DatabasePager to
do what is desired here - i.e. lazy updating of the graphics.  It
might be possible to tell the DatabasePager that rendering of frame is
switched off for that frame and for it handle this case.  Tweaking the
application code so that it doesn't do an viewer.advance() until a new
frame is actually required.

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.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-23 Thread Evan Andersen
Robert,

Things seem to work fine if I only call advance() when a render is done.
Off the top of your head, can you think of any problems that might be caused
by not doing an advance for every iteration of the event and update
traversals?  Would it be better to advance the reference time at each
iteration and only advance the frame number when a render is performed?

Also in regards to the potential problems with pre-compiling objects, I
assume that I can just call requiresCompileGLObjects on the pager in each
iteration of the main loop and then do a render if it returns true.  My main
concern is doing unnecessary renders while the pager is downloading tiles
from an internet source.

Thanks for all your help.

Evan


On Thu, Apr 23, 2009 at 10:16 AM, Robert Osfield
robert.osfi...@gmail.comwrote:

 On Thu, Apr 23, 2009 at 4:32 PM, Robert Osfield
 robert.osfi...@gmail.com wrote:
  Thanks Evan, with your example I'm able to see the problem when
  browsing http://www.openscenegraph.org/data/earth_bayarea/earth.ive.
  I'll now dig into the DatabasePager to see what is up.

 The culprit looks to be the following (normally valid) code in
 DatabasePager::capped_removeExpiredSubgraphs(const osg::FrameStamp
 frameStamp):

int delta = frameStamp.getFrameNumber() -
 plod-getFrameNumberOfLastTraversal();
if (delta1)
{
if (_releaseDelay!=DBL_MAX)
{
plod-releaseGLObjects();

 osg::notify(osg::NOTICE)DatabasePager::removeExpiredSubgraphs(),
 releasing gl objectsstd::endl;
}

_inactivePagedLODList.push_back(plod);

itr = _activePagedLODList.erase(itr);
}


 The only reason why this is a problem in this particular usage case is
 that you have a viewer that is continue to increment the frame count
 so the  frameStamp.getFrameNumber() keeps getting incremented, but
 since the scene isn't being rendering the
 plod-getFrameNumberOfLastTraversal() is not updating so the frame
 delta becomes  1 and the PagedLOD gets assigned as expired.

 The code in DatabasePager is correct for how the pager + PagedLOD were
 designed to be used.  The problem is that code is now being used in
 way that is wasn't originally intended.  Updating the frame count and
 not rendering is the problem.  Not updating the frame count and not
 rendering would work, as does updating the frame count and rendering.

 The next question is how to either get the viewer or DatabasePager to
 do what is desired here - i.e. lazy updating of the graphics.  It
 might be possible to tell the DatabasePager that rendering of frame is
 switched off for that frame and for it handle this case.  Tweaking the
 application code so that it doesn't do an viewer.advance() until a new
 frame is actually required.

 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.

 Robert.
 ___
 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


Re: [osg-users] DBPager continuously reloading tiles

2009-04-23 Thread Robert Osfield
HI Evan et. al,


On Thu, Apr 23, 2009 at 5:16 PM, Robert Osfield
robert.osfi...@gmail.com 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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-23 Thread Robert Osfield
On Thu, Apr 23, 2009 at 5:51 PM, Evan Andersen andersen.e...@gmail.com wrote:
 Things seem to work fine if I only call advance() when a render is done.
 Off the top of your head, can you think of any problems that might be caused
 by not doing an advance for every iteration of the event and update
 traversals?  Would it be better to advance the reference time at each
 iteration and only advance the frame number when a render is performed?

Not calling advance should be fine.  See the email I just sent.

 Also in regards to the potential problems with pre-compiling objects, I
 assume that I can just call requiresCompileGLObjects on the pager in each
 iteration of the main loop and then do a render if it returns true.  My main
 concern is doing unnecessary renders while the pager is downloading tiles
 from an internet source.

Problem solved, see the email just sent.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-23 Thread Robert Osfield
Hi All,

Out of curiosity I did some power tests viewing a paged database with
different viewer frame updating configs.  Power is measure at the wall
using so it's the complete machine.  T

103W Compute at idle
103W Lazy frame rendering (based on modified version of Evan's viewer)
125W Continuous framer rate (standard osgviewer) with vsync on (60fps)
156W Continuous framer rate (standard osgviewer) with vsync off (300 - 2000fps)

The Lazy frame rendering does bump up it's power consumption when the
scene is updating or the view is moving so it's only the time when the
view is still that the power consumption goes down, so actual power
usage will vary with user interaction.

So... lazy frame updates/rendering is good for the power consumption
(~20% better) , good for keeping lower computer temperatures and
noise, and should be better component life to boot.

Makes me wonder if it's not time to add support directly into
osgViewer for lazy frame updates/rendering.  On the same track,
perhaps we should also consider artificially restricting frame rate to
prevent running apps running at full pelt due to vsync being off.
The later is possible more important under Linux as I've found ATI,
Nvidia and Intel drivers neglect to enable vysnc by default.  Getting
this fixed is another battle though...

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-23 Thread Jean-Sébastien Guay

Hi Robert,


On the same track,
perhaps we should also consider artificially restricting frame rate to
prevent running apps running at full pelt due to vsync being off.
The later is possible more important under Linux as I've found ATI,
Nvidia and Intel drivers neglect to enable vysnc by default.  Getting
this fixed is another battle though...


As an additional data point, on Windows, the NVidia drivers ship with 
vsync enabled by default, but ATI ships with it disabled. This always 
bugs me when setting up a new machine.


If you want to add a feature for capping the frame rate, then I'd like 
to suggest having a key, a command-line arg and an environment variable 
to enable/disable this, and perhaps a way of setting the target frame 
rate. Personally I prefer letting users have the choice, through the 
vsync setting in their driver, whether they want to cap the frame rate 
or not.


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-22 Thread Evan Andersen
Ryan,

Thank you for the suggestion.  When I call
setTargetMaximumNumberOfPagedLOD(0) on the database pager, as you suggested
and then set the expiry delay to DBL_MAX and the expiry frames to 10, as
Jason Suggested the problem seems to go away.  I'm not really sure why this
works.  It seems like the default behavior should work in my usage case, but
at least it is working now.

-Evan


On Tue, Apr 21, 2009 at 9:25 AM, Kawicki, Ryan H
ryan.h.kawi...@boeing.comwrote:

  As in your case, we also have high resolution insets which exhibit this
 problem, but our applications are centered around a continuous render
 update.

 Robert can correct me if I am wrong, but the new mechanism for controlling
 how nodes are paged in and out of memory is defaulted to ( I think ) 300 for
 the target maximum number of page lods.  Because this value is set, removing
 of expired subgraphs will go down the path of removing capped paged lods
 instead of the expiry.  To use the expiry system of old, make sure to call
 setTargetMaximumNumberOfPageLOD(0) on the database pager, and the expiry
 values you have set should kick in.

 We have tried increasing the target maximum, but we run a greater risk of
 consuming too much memory for a 32 bit application on Windows.  Because of
 time restraints, I have not been able to follow-up on this problem.  Sorry.

 *Ryan H. Kawicki*
 The Boeing Company
 Training Systems  Services
 Software Engineer


  --
 *From:* Evan Andersen [mailto:andersen.e...@gmail.com]
 *Sent:* Monday, April 13, 2009 10:08 AM
 *To:* OpenSceneGraph Users
 *Subject:* Re: [osg-users] DBPager continuously reloading tiles

 I tried the settings you suggested Jason, but I still get the same
 behavior.

 -Evan


 On Fri, Apr 10, 2009 at 5:57 PM, Jason Beverage 
 jasonbever...@gmail.comwrote:

 Hi Evan,

 What happens if you set the expiry frame to something like 10 and the
 expiry time to DBL_MAX?

 I haven't tried running the DatabasePager without non-continuous
 rendering, so I'm not sure how well it works.

 Jason


 On Fri, Apr 10, 2009 at 5:20 PM, Evan Andersen 
 andersen.e...@gmail.comwrote:


 Thanks for your response Robert.  I just tried setting the expiry delay
 of the database pager to 10, 100, and 1000, but still have the same
 problem.  I also tried increasing the expiry frames count to 60, but that
 didn't help either.

 -Evan


   On Fri, Apr 10, 2009 at 2:33 PM, Robert Osfield 
 robert.osfi...@gmail.com wrote:

   On Fri, Apr 10, 2009 at 6:43 PM, Evan Andersen 
 andersen.e...@gmail.com wrote:

 Sorry, I forgot to mention that.  I'm using version 2.9.2 from the
 trunk.


 Thanks for the clarification.  Changes in DatabasePager in 2.8 onwards
 should make it easier to do what you are doing.  The DatabasePager and
 PagedLOD were still designed around continuous rendering though so you are
 running a bit off usual usage model so might need to tweak a few things.

 My guess is that the PageLOD are expiring their children as they haven't
 been traversed for a given amount of time.  You can adjust the expiry delay
 via the DatabaePager API so have a browse.

 Robert.






 ___
 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



 ___
 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


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-21 Thread Kawicki, Ryan H
As in your case, we also have high resolution insets which exhibit this
problem, but our applications are centered around a continuous render
update.
 
Robert can correct me if I am wrong, but the new mechanism for
controlling how nodes are paged in and out of memory is defaulted to ( I
think ) 300 for the target maximum number of page lods.  Because this
value is set, removing of expired subgraphs will go down the path of
removing capped paged lods instead of the expiry.  To use the expiry
system of old, make sure to call setTargetMaximumNumberOfPageLOD(0) on
the database pager, and the expiry values you have set should kick in.
 
We have tried increasing the target maximum, but we run a greater risk
of consuming too much memory for a 32 bit application on Windows.
Because of time restraints, I have not been able to follow-up on this
problem.  Sorry.

Ryan H. Kawicki 
The Boeing Company 
Training Systems  Services 
Software Engineer 

 




From: Evan Andersen [mailto:andersen.e...@gmail.com] 
Sent: Monday, April 13, 2009 10:08 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] DBPager continuously reloading tiles


I tried the settings you suggested Jason, but I still get the
same behavior.

-Evan



On Fri, Apr 10, 2009 at 5:57 PM, Jason Beverage
jasonbever...@gmail.com wrote:


Hi Evan,

What happens if you set the expiry frame to something
like 10 and the expiry time to DBL_MAX?

I haven't tried running the DatabasePager without
non-continuous rendering, so I'm not sure how well it works.

Jason 


On Fri, Apr 10, 2009 at 5:20 PM, Evan Andersen
andersen.e...@gmail.com wrote:



Thanks for your response Robert.  I just tried
setting the expiry delay of the database pager to 10, 100, and 1000, but
still have the same problem.  I also tried increasing the expiry frames
count to 60, but that didn't help either.

-Evan



On Fri, Apr 10, 2009 at 2:33 PM, Robert Osfield
robert.osfi...@gmail.com wrote:


On Fri, Apr 10, 2009 at 6:43 PM, Evan
Andersen andersen.e...@gmail.com wrote:


Sorry, I forgot to mention that.  I'm
using version 2.9.2 from the trunk.



Thanks for the clarification.  Changes
in DatabasePager in 2.8 onwards should make it easier to do what you are
doing.  The DatabasePager and PagedLOD were still designed around
continuous rendering though so you are running a bit off usual usage
model so might need to tweak a few things.

My guess is that the PageLOD are
expiring their children as they haven't been traversed for a given
amount of time.  You can adjust the expiry delay via the DatabaePager
API so have a browse.

Robert.



 




___
osg-users mailing list
osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g





___
osg-users mailing list
osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g





___
osg-users mailing list
osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g




___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-13 Thread Evan Andersen
I tried the settings you suggested Jason, but I still get the same behavior.

-Evan


On Fri, Apr 10, 2009 at 5:57 PM, Jason Beverage jasonbever...@gmail.comwrote:

 Hi Evan,

 What happens if you set the expiry frame to something like 10 and the
 expiry time to DBL_MAX?

 I haven't tried running the DatabasePager without non-continuous rendering,
 so I'm not sure how well it works.

 Jason


 On Fri, Apr 10, 2009 at 5:20 PM, Evan Andersen andersen.e...@gmail.comwrote:


 Thanks for your response Robert.  I just tried setting the expiry delay of
 the database pager to 10, 100, and 1000, but still have the same problem.  I
 also tried increasing the expiry frames count to 60, but that didn't help
 either.

 -Evan


 On Fri, Apr 10, 2009 at 2:33 PM, Robert Osfield robert.osfi...@gmail.com
  wrote:

 On Fri, Apr 10, 2009 at 6:43 PM, Evan Andersen 
 andersen.e...@gmail.comwrote:

 Sorry, I forgot to mention that.  I'm using version 2.9.2 from the
 trunk.


 Thanks for the clarification.  Changes in DatabasePager in 2.8 onwards
 should make it easier to do what you are doing.  The DatabasePager and
 PagedLOD were still designed around continuous rendering though so you are
 running a bit off usual usage model so might need to tweak a few things.

 My guess is that the PageLOD are expiring their children as they haven't
 been traversed for a given amount of time.  You can adjust the expiry delay
 via the DatabaePager API so have a browse.

 Robert.






 ___
 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



 ___
 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


Re: [osg-users] DBPager continuously reloading tiles

2009-04-10 Thread Robert Osfield
Hi Evan,

Which version of the OSG are you using?

Robert.

On Fri, Apr 10, 2009 at 6:07 PM, Evan Andersen andersen.e...@gmail.comwrote:

 I'm working on an application which uses osgEarth to display terrain
 databases to users.  I need the application to use as little CPU time as
 possible while still providing good user interaction, so I have set my
 viewer up so that it only renders when necessary.  I keep a loop running
 that does the event and update traversals, but the renderingTraversals are
 only done when requestRedraw or requestContinuousUpdate have been called.
 This seems to work fine and to the user it generally beahves the same as
 when the scene is continuously rendered.  However, when viewing the high
 detail levels it database pager often gets stuck in a loop when it keeps
 reloading a set of tiles over and over.  You see the tiles alternately go
 blurry and then sharp again as the continously reload.

 I don't know what is causing this, but if I switch to continuous render, so
 that every event and update traversal is followed by a render, the problem
 does not occur.  It seems to happen most often loading earth files with
 high-res data, like the yahoo or google test files, and then moving the
 camera around at the high detail levels.  Unfortunately, I can't seem to
 replicate the problem with an animation path.  I have attached a simple
 viewer I created that implements the rendering method I described above.
 The important code is in the viewer's frame function.  I've pasted it below
 in case anyone can tell at a glance what I'm doing wrong.  If someone who
 knows the database pager well could take a look at this I would really
 appreciate it.

 Thanks,
 Evan


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

 updateTraversal();

 if(needsRender || continuousUpdate)
 {
 renderingTraversals();
 needsRender = false;
 }


 ___
 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


Re: [osg-users] DBPager continuously reloading tiles

2009-04-10 Thread Evan Andersen
Sorry, I forgot to mention that.  I'm using version 2.9.2 from the trunk.

-Evan

On Fri, Apr 10, 2009 at 11:28 AM, Robert Osfield
robert.osfi...@gmail.comwrote:

 Hi Evan,

 Which version of the OSG are you using?

 Robert.

 On Fri, Apr 10, 2009 at 6:07 PM, Evan Andersen andersen.e...@gmail.comwrote:

 I'm working on an application which uses osgEarth to display terrain
 databases to users.  I need the application to use as little CPU time as
 possible while still providing good user interaction, so I have set my
 viewer up so that it only renders when necessary.  I keep a loop running
 that does the event and update traversals, but the renderingTraversals are
 only done when requestRedraw or requestContinuousUpdate have been called.
 This seems to work fine and to the user it generally beahves the same as
 when the scene is continuously rendered.  However, when viewing the high
 detail levels it database pager often gets stuck in a loop when it keeps
 reloading a set of tiles over and over.  You see the tiles alternately go
 blurry and then sharp again as the continously reload.

 I don't know what is causing this, but if I switch to continuous render,
 so that every event and update traversal is followed by a render, the
 problem does not occur.  It seems to happen most often loading earth files
 with high-res data, like the yahoo or google test files, and then moving the
 camera around at the high detail levels.  Unfortunately, I can't seem to
 replicate the problem with an animation path.  I have attached a simple
 viewer I created that implements the rendering method I described above.
 The important code is in the viewer's frame function.  I've pasted it below
 in case anyone can tell at a glance what I'm doing wrong.  If someone who
 knows the database pager well could take a look at this I would really
 appreciate it.

 Thanks,
 Evan


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

 updateTraversal();

 if(needsRender || continuousUpdate)
 {
 renderingTraversals();
 needsRender = false;
 }


 ___
 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


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] DBPager continuously reloading tiles

2009-04-10 Thread Jason Beverage
Hi Evan,

What happens if you set the expiry frame to something like 10 and the expiry
time to DBL_MAX?

I haven't tried running the DatabasePager without non-continuous rendering,
so I'm not sure how well it works.

Jason

On Fri, Apr 10, 2009 at 5:20 PM, Evan Andersen andersen.e...@gmail.comwrote:


 Thanks for your response Robert.  I just tried setting the expiry delay of
 the database pager to 10, 100, and 1000, but still have the same problem.  I
 also tried increasing the expiry frames count to 60, but that didn't help
 either.

 -Evan


 On Fri, Apr 10, 2009 at 2:33 PM, Robert Osfield 
 robert.osfi...@gmail.comwrote:

 On Fri, Apr 10, 2009 at 6:43 PM, Evan Andersen 
 andersen.e...@gmail.comwrote:

 Sorry, I forgot to mention that.  I'm using version 2.9.2 from the trunk.


 Thanks for the clarification.  Changes in DatabasePager in 2.8 onwards
 should make it easier to do what you are doing.  The DatabasePager and
 PagedLOD were still designed around continuous rendering though so you are
 running a bit off usual usage model so might need to tweak a few things.

 My guess is that the PageLOD are expiring their children as they haven't
 been traversed for a given amount of time.  You can adjust the expiry delay
 via the DatabaePager API so have a browse.

 Robert.






 ___
 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


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org