Hi All,

I'm trying to write 3d texture data to file but when loading back into
osg::Image I'm getting rubbish:

Writing to file with 3d texture data:

unsigned int size = image->getTotalSizeInBytesIncludingMipmaps();
fout.write( (char*)image->data(), size );


Reading from file:

unsigned char* data = new unsigned char[texSize*texSize*texSize*4];
std::ifstream fin("image3ddata2",std::ios::binary);
   
fin.read((char*)&data ,(sizeof(unsigned char)* 4 * texSize * texSize *
texSize));
   
osg::ref_ptr<osg::Image> image = new osg::Image;
image->setImage(texSize,texSize,texSize,4, GL_RGBA,
GL_UNSIGNED_BYTE,data, osg::Image::USE_NEW_DELETE);


Can anyone see anything I'm doing wrong? Either Writing or Reading?

Best Regards

Paul

IMPORTANT: This email remains the property of the Department of Defence and is 
subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have 
received this email in error, you are requested to contact the sender and 
delete the email.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to