[osg-users] Buffer object pool and setUnrefImageDataAfterApply()

Robert Osfield robert.osfield at gmail.com
Tue Feb 14 01:03:47 PST 2017


HI Jannik,

When using a texture object pool you have a smaller set of texture
objects than you have osg::Texture in your scene, if a Texture is
required for rendering but doesn't yet have a texture object assigned
it needs to download it's osg::Image data to the texture object.  If
the texture object pool fills up then you have to recycle texture
objects reassigning no longer active texture objects to osg::Texture
that require them, this means that whilst one osg::Texture will gain a
texture object for it's rendering, the original osg::Texture that held
that texture object has to reset to 0, when this osg::Texture is then
nexted rendered it'll need to redownload it's osg::Image.

The mechanism requires that the osg::Image assigned to osg::Texture
are never removed otherwise you end up not being able to render
Texture's that no longer have their original texture object.

Robert.



On 14 February 2017 at 01:58, Jannik Heller <scrawl at baseoftrash.de> wrote:
> Hi,
>
> I was considering to use the buffer/texture object pool for my program (see http://forum.openscenegraph.org/viewtopic.php?t=3844&view=previous )
>
> What strikes me as odd, though, is how enabling texture buffer pools automatically disables the use of unrefImageDataAfterApply() for textures:
>
>         /** Returns true if the associated Image should be released and it's safe to do so. */
>         bool isSafeToUnrefImageData(const State& state) const {
>             return (_unrefImageDataAfterApply && state.getMaxTexturePoolSize()==0 && areAllTextureObjectsLoaded());
>         }
>
> Why is that the case? Would there be a way to use texture buffer pools while keeping the memory usage benefits of unref-ing the image data after its applied?
>
> Cheers,
> Jannik
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=70180#70180
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



More information about the osg-users mailing list