setUnrefImageDataAfterApplyPolicy

classic Classic list List threaded Threaded
3 messages Options
LvQing LvQing
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

setUnrefImageDataAfterApplyPolicy

Hello!
    I am a little confuse about viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy().


1.viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy( false, false )

2.viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy( true, true)


which is the best way to reduce memory usage?


                                                                                    ThX!
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: setUnrefImageDataAfterApplyPolicy

That's a very confusing function for sure :)  

Actually both of those will result in same thing with regards to osgEarth images.

The first parameter tells osg whether it should change the value of the unrefImageAfter apply setting.  By default it's true.
The second parameter tells osg what to change the value to if the first parameter is true.  By default, this is false.  

So by default, osg will change the texture unref policy to NOT unref, no matter what it is set to.

osgEarth sets the setUnrefImageAfterApply setting to true for most textures that can be safely discard, so to reduce memory we need to tell osg not to change the existing policy.

So:
viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy( false, false )  
tells osg not to change the policy and the second parameter doesn't matter.  This works to reduce memory b/c osgEarth already sets the unref setting correctly and we tell the pager to leave it alone.

viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy( true, true)   
tells osg to change the policy to unref the images, which is fine as well since we set the unref policy as well.

Hope that helps,

Jason 


On Thu, Jun 29, 2017 at 12:27 PM Lv Qing [via osgEarth] <[hidden email]> wrote:
Hello!
    I am a little confuse about viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy().


1.viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy( false, false )

2.viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy( true, true)


which is the best way to reduce memory usage?


                                                                                    ThX!


If you reply to this email, your message will be added to the discussion below:
http://forum.osgearth.org/setUnrefImageDataAfterApplyPolicy-tp7591032.html
To start a new topic under osgEarth, email [hidden email]
To unsubscribe from osgEarth, click here.
NAML
LvQing LvQing
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: setUnrefImageDataAfterApplyPolicy

Thank you for your reply!
Loading...