Hi,

the USE_NEW_DELETE and USE_MALLOC_FREE are hints to the osg::Image class that _it_ does the memory deallocation. If the image data is allocated by you and you want to delete it yourself, use NO_DELETE.

See Image.cpp

void Image::deallocateData()
{
    if (_data) {
        if (_allocationMode==USE_NEW_DELETE) delete [] _data;
        else if (_allocationMode==USE_MALLOC_FREE) ::free(_data);
        _data = 0;
    }
}

jp

Rabbi Robinson wrote:
Hi,

I am trying to create an image out of a memory block:

unsigned char * data= new unsigned char[1024];
image->setImage (int s, int t, int r, GLint internalTextureformat, GLenum 
pixelFormat, GLenum type, unsigned char *data, AllocationMode mode, int packing=1)

For Allocation mode, there are
NO_DELETE       
USE_NEW_DELETE  
USE_MALLOC_FREE
So far only NO_DELETE works for me. The other two will crashes no matter what.

Dose that mean that if I use USE_NEW_DELETE or USE_MALLOC_FREE, I don't need to 
pre allocate the memory for it and just pass a NULL for the data?

Thank you!

Cheers,
Rabbi

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16216#16216





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


--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support.

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

Reply via email to