Hi Robert,

osg::Image inherits from osg::BufferData. The BufferData cannot be unreferenced separately.

The behavior you describe is the what happen if "unref image data after apply" is true and "copy data and release GL buffer object" is false (like in my submission).

Multi-context doesn't work if "unref image data after apply" is true because the image is referenced only once by the texture and not one per context.



On 14/12/2012 11:20, Robert Osfield wrote:
Hi Lionel,

On 14 December 2012 10:07, Lionel Lagarde <[email protected] <mailto:[email protected]>> wrote:

    Hi Robert,

    Proposal:

    new member: BufferData::_numUsers initialized to
    BufferData::getReferenceCount when the GL buffer object is created
    and filled

    In Texture:apply, decrement the _numUsers member of the Image and
    release the GL buffer object if the sum of the _numUsers of all
    the BufferData contained if the GL buffer object is 0

    Any thoughts ?


Doesn't feel elegant to me.

I wonder if we could unref the BufferData by removing it form the osg::Image and let it's ref count control it's destruction, and when it destructs it'll destruct the PixelBufferObject if it no longer has any references.

This would be a bit similar to the way that the osg::Image is unref'd. Like this mechanism we'd need to make sure that the BufferData is applied to all the contexts that require it.

Robert.


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to