HI Bruno, Simply clone the image i.e.
osg::ref_ptr<osg::Image> iimag_copy = osg::clone(img); The osg::Image will copy the internal image data without attempting to share it, and will own it's own local copy of the data and delete it automatically when img_copy is deleted (ref count goes to 0.) Robert On 22 August 2016 at 21:46, Bruno Oliveira <[email protected]> wrote: > Hello, > > the following code block is creating an image from a buffer I own. This does > not allocate a new buffer, but assumes my buffer will not be deallocated. > How do I create a new, independent osg::Image copying data from my buffer to > an internal array? > > osg::Image img = osg::image(); > img->setImage( > width, > height, > 1, > internalTextureFormat(), > type(), > MyDataBuffer(), > osg::Image::NO_DELETE); > > > > _______________________________________________ > 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

