Re: [osg-users] Allocating osg::image from my own data buffer

2016-08-23 Thread Robert Osfield
HI Bruno,

Simply clone the image i.e.

  osg::ref_ptr 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
 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
> 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] Allocating osg::image from my own data buffer

2016-08-22 Thread Bruno Oliveira
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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org