Hi michael,<br>  The osg format file can be loaded. The problem has to do with std::istream >> operator reading binary stream.<br/><br/>------------------ 原始邮件 ------------------<br/><div style="font-size: 12px; background: none repeat scroll 0% rgb(239, 239, 239); padding: 8px;"><div id="menu_sender"><b>发件人:</b> "michael kapelko" <kornerr@gmail.com>;</div><div><b>发送时间:</b> 2017年5月27日(星期六) 17:13</div><div><b>收件人:</b> "OpenSceneGraph Users" <osg-users@lists.openscenegraph.org>;</div><div><b>主题:</b> Re: [osg-users] A problem with regard to std:istream on Android</div></div><br/><br/>Hi.<br  /><br  />Are you sure /sdcard path is valid at all? Different Android versions<br  />use different sdcard paths. Use getExternalStorageDirectory():<br  />https://stackoverflow.com/a/21230946/3404710<br  />Note that you need a special permission to read from external storage, too.<br  /><br  /><br  />2017-05-26 13:06 GMT+07:00 龚来恩 <8802661@qq.com>:<br  />> Hi All,<br  />>     I'm trying to make osgEarth run on Android (OSG 3.2 & osgEarth 2.3). Now<br  />> the earth can display on Android system. But I run into a problem with<br  />> regard to std:istream. I tried to load an osgb file by the following code<br  />> osg::ref_ptr<osg::Node> node =<br  />> osgDB::readNodeFile("/sdcard/WV/Models/tk.osgb");<br  />> the variable node's value is always be NULL.  I step into this line and<br  />> traced down to file ReaderWriterOSG2.cpp<br  />> virtual ReadResult readNode( const std::string& file, const Options* options<br  />> ) const<br  />>     {<br  />>         ReadResult result = ReadResult::FILE_LOADED;<br  />>         std::string fileName = file;<br  />>         std::ios::openmode mode = std::ios::in;<br  />>         Options* local_opt = prepareReading( result, fileName, mode, options<br  />> );<br  />>         if ( !result.success() ) return result;<br  />><br  />>         osgDB::ifstream istream( fileName.c_str(), mode );<br  />>         return readNode( istream, local_opt );<br  />>     }<br  />><br  />> virtual ReadResult readNode( std::istream& fin, const Options* options )<br  />> const<br  />>     {<br  />>         osg::ref_ptr<InputIterator> ii = readInputIterator(fin, options);<br  />>         if ( !ii ) return ReadResult::FILE_NOT_HANDLED;<br  />><br  />>         InputStream is( options );<br  />>         if ( is.start(ii.get())!=InputStream::READ_SCENE )<br  />>         {<br  />>             CATCH_EXCEPTION(is);<br  />>             return ReadResult::FILE_NOT_HANDLED;<br  />>         }<br  />><br  />>         is.decompress(); CATCH_EXCEPTION(is);<br  />>         osg::Node* node = dynamic_cast<osg::Node*>(is.readObject());<br  />> CATCH_EXCEPTION(is);<br  />>         return node;<br  />>     }<br  />><br  />> the debugger couldn't step into the function readNode( std::istream& fin,<br  />> const Options* options ). But on windows it works.<br  />><br  />> Can anybody tell me how to solve this problem?<br  />><br  />> Dev Environment:<br  />>     Visual Studio 2017<br  />>     Android 7.0<br  />>     Android NDK64 r13b<br  />>     Arch arm64-v8a<br  />><br  />> Best regards.<br  />><br  />> Glen<br  />><br  />><br  />> _______________________________________________<br  />> osg-users mailing list<br  />> osg-users@lists.openscenegraph.org<br  />> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org<br  />><br  />><br  />> _______________________________________________<br  />> osg-users mailing list<br  />> osg-users@lists.openscenegraph.org<br  />> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org<br  />><br  />_______________________________________________<br  />osg-users mailing list<br  />osg-users@lists.openscenegraph.org<br  />http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org<br  />