Hi,
I posted a solution for the ReaderWriterTIFF plugin awhile ago for discussion.
Here is my final proposal for fixing this bug. For a simple reconstruction of
the bug try this short code:
Code:
osg::Image* img = new osg::Image();
img->allocateImage(32,32,1,GL_RGB, GL_UNSIGNED_BYTE);
osgDB::ReaderWriter* _rw =
osgDB::Registry::instance()->getReaderWriterForExtension("tiff");
osgDB::ReaderWriter::Options* _rwOptions = new osgDB::ReaderWriter::Options();
std::stringstream outStream;
std::ofstream outfile("outp.tif", std::ios::out | std::ios::binary);
_rw->writeImage( *img, outfile, _rwOptions); //Line A
/*_rw->writeImage( *img, outStream, _rwOptions); //Line B
std::string outBuf = outStream.str();
outfile << outBuf;
*/
outfile.close();
The variation with the ofstream (Line A) works with the current implementation,
the variation with the stringstream (Line B) will result in error messages and
corrupt Tiffs. When using the attached fixed implementation, both versions work.
This functionallity is needed to allow osgEarth the caching of depth maps into
sqlite databases.
Greetings,
Oliver
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=38580#38580
Attachments:
http://forum.openscenegraph.org//files/readerwritertiff_202.cpp
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org