From Colin McDonald, "The writeImage method in ReaderWriterPNM.cpp had an error checking the

accepted file extensions, so that once the plugin was loaded in the
Registry it would grab any image file write request, regardless of the
file extension.  This was a particular problem if it was statically loaded."
This commit is contained in:
Robert Osfield 2007-05-24 16:11:42 +00:00
parent a22a7f867e
commit 80d260c472

View File

@ -468,8 +468,9 @@ class ReaderWriterPNM : public osgDB::ReaderWriter
virtual WriteResult writeImage(const osg::Image& image,const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
{
// Only ppm format output supported
std::string ext = osgDB::getFileExtension(fileName);
if (!acceptsExtension("ppm")) return WriteResult::FILE_NOT_HANDLED;
if ( !osgDB::equalCaseInsensitive(ext, "ppm") ) return WriteResult::FILE_NOT_HANDLED;
// only support rgb images right now.
if (image.getPixelFormat()!=GL_RGB || image.getDataType()!=GL_UNSIGNED_BYTE) return WriteResult("Error image pixel format not supported by pnm writer.");