Hello,
I
googled the reason why the osg plugin couldn't load an osgb or ive file on Android system. Because std::istream
>> operate skips spaces
which was used widely by osg plugins to read binary stream. It works on windows. But this doesn't work on Andoid.
The osg file can't be loaded successfully, so >> operate can normally work if reading stream
with text format. It's time consuming to convert all data format from osgb to osg. Can anybody give me a better choice?
Thank you in advance!
Glen
8802...@qq.com
From: 龚来恩Date: 2017-05-26 14:06Subject: [osg-users] A problem with regard to std:istream on AndroidHi All,I'm trying to make osgEarth run on Android (OSG 3.2 & osgEarth 2.3). Now the earth can display on Android system. But I run into a problem with regard to std:istream. I tried to load an osgb file by the following codeosg::ref_ptr<osg::Node> node = osgDB::readNodeFile("/sdcard/WV/Models/tk.osgb");the variable node's value is always be NULL. I step into this line and traced down to file ReaderWriterOSG2.cppvirtual ReadResult readNode( const std::string& file, const Options* options ) const
{
ReadResult result = ReadResult::FILE_LOADED;
std::string fileName = file;
std::ios::openmode mode = std::ios::in;
Options* local_opt = prepareReading( result, fileName, mode, options );
if ( !result.success() ) return result;
osgDB::ifstream istream( fileName.c_str(), mode );
return readNode( istream, local_opt );
}
virtual ReadResult readNode( std::istream& fin, const Options* options ) const
{
osg::ref_ptr<InputIterator> ii = readInputIterator(fin, options);
if ( !ii ) return ReadResult::FILE_NOT_HANDLED;
InputStream is( options );
if ( is.start(ii.get())!=InputStream::READ_SCENE )
{
CATCH_EXCEPTION(is);
return ReadResult::FILE_NOT_HANDLED;
}
is.decompress(); CATCH_EXCEPTION(is);
osg::Node* node = dynamic_cast<osg::Node*>(is.readObject()); CATCH_EXCEPTION(is);
return node;
}
the debugger couldn't step into the function readNode( std::istream& fin, const Options* options ). But on windows it works.
Can anybody tell me how to solve this problem?
Dev Environment:Visual Studio 2017Android 7.0Android NDK64 r13bArch arm64-v8a
Best regards.
Glen
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org