<html>
<head></head>
<body>
<p> <span style="font-family: 'Microsoft YaHei UI'; font-size: 14px; line-height: 21px; widows: auto;">Hello,</span></p>
<div style="font-family: 'Microsoft YaHei UI'; font-size: 14px; line-height: 21px; widows: auto;">
<span microsoft="" yahei="" ui="" font-size:="" 14px="" color:="" rgb="" 0="" background-color:="" rgba="" font-weight:="" normal="" font-style:="" text-decoration:="" none="" style="font-family: '';"> I</span>
<span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;"> googled the reason why the osg plugin couldn't load an osgb or ive file on Android system. Because std::istream </span>
<span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;">>> operate skips spaces</span>
<span style="background-color: window; font-family: ''; font-size: 10.5pt; line-height: 1.5;"> which was used widely by osg plugins to read binary stream. It works on windows. But this doesn't work on Andoid.</span>
</div>
<div style="font-family: 'Microsoft YaHei UI'; font-size: 14px; line-height: 21px; widows: auto;">
<span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;"> The osg file can't be loaded successfully, so >> operate can normally work if reading stream</span>
<span style="background-color: window; font-family: ''; font-size: 10.5pt; line-height: 1.5;"> with text format. It's time consuming to convert all data format from osgb to osg. Can anybody give me a better choice?</span>
</div>
<div style="font-family: 'Microsoft YaHei UI'; font-size: 14px; line-height: 21px; widows: auto;">
<span style="background-color: window; font-family: ''; font-size: 10.5pt; line-height: 1.5;"><br /></span>
</div>
<div style="font-family: 'Microsoft YaHei UI'; font-size: 14px; line-height: 21px; widows: auto;">
Thank you in advance!
</div>
<div style="font-family: 'Microsoft YaHei UI'; font-size: 14px; line-height: 21px; widows: auto;">
<span style="background-color: window; font-family: ''; font-size: 10.5pt; line-height: 1.5;">Glen </span>
</div>
<div style="font-family: 'Microsoft YaHei UI'; font-size: 14px; line-height: 21px; widows: auto;">
<br />
</div>
<hr color="#b5c4df" size="1" align="left" style="box-sizing: border-box; font-family: 'Microsoft YaHei UI'; font-size: 14px; line-height: 21px; widows: auto; width: 210px; height: 1px;" />
<div style="font-family: 'Microsoft YaHei UI'; font-size: 14px; line-height: 21px; widows: auto;">
<div style="position: static !important; margin: 10px; font-family: verdana; font-size: 10pt;">
<div style="position: static !important;">
8802661@qq.com
</div>
</div>
</div>
<blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; font-family: 'Microsoft YaHei UI'; font-size: 14px; line-height: 21px; widows: auto;">
<div>
</div>
<div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0cm 0cm;">
<div style="padding: 8px; font-size: 12px; font-family: tahoma; position: static !important; background-color: rgb(239, 239, 239);">
<div>
<strong>From:</strong>
<a href="mailto:8802661@qq.com" style="text-decoration: none !important;">龚来恩</a>
</div>
<div>
<strong>Date:</strong> 2017-05-26 14:06
</div>
<div>
<strong>To:</strong>
<a href="mailto:osg-users@lists.openscenegraph.org" style="text-decoration: none !important;">OpenSceneGraph Users</a>
</div>
<div>
<strong>Subject:</strong> [osg-users] A problem with regard to std:istream on Android
</div>
</div>
</div>
<div>
<div class="FoxDiv20170527113421797273" style="position: static !important;">
<div>
Hi All,
</div>
<div>
<span microsoft="" yahei="" ui="" font-size:="" 14px="" color:="" rgb="" 0="" background-color:="" rgba="" font-weight:="" normal="" font-style:="" text-decoration:="" none="" style="font-family: '';"> 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 code</span>
</div>
<div>
<span microsoft="" yahei="" ui="" font-size:="" 14px="" color:="" rgb="" 0="" background-color:="" rgba="" font-weight:="" normal="" font-style:="" text-decoration:="" none="" style="font-family: '';"><span microsoft="" yahei="" ui="" font-size:="" 14px="" color:="" rgb="" 0="" background-color:="" rgba="" font-weight:="" normal="" font-style:="" text-decoration:="" none="" style="font-family: '';">osg::ref_ptr<osg::Node> node = osgDB::readNodeFile("/sdcard/WV/Models/tk.osgb");</span></span>
</div>
<div>
the variable node's value is always be NULL. I step into this line and traced down to file ReaderWriterOSG2.cpp
</div>
<span microsoft="" yahei="" ui="" font-size:="" 14px="" color:="" rgb="" 0="" background-color:="" rgba="" font-weight:="" normal="" font-style:="" text-decoration:="" none="" style="font-family: '';">virtual ReadResult readNode( const std::string& file, const Options* options ) 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 /> if ( !result.success() ) return result;<br /><br /> osgDB::ifstream istream( fileName.c_str(), mode );<br /> return readNode( istream, local_opt );<br /> }</span>
<div>
<br />
</div>
<div>
<span microsoft="" yahei="" ui="" font-size:="" 14px="" color:="" rgb="" 0="" background-color:="" rgba="" font-weight:="" normal="" font-style:="" text-decoration:="" none="" style="font-family: '';">virtual ReadResult readNode( std::istream& fin, const Options* options ) 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()); CATCH_EXCEPTION(is);<br /> return node;<br /> }</span>
</div>
<div>
<br />
</div>
<div>
the debugger couldn't step into the function readNode( std::istream& fin, const Options* options ). But on windows it works.
</div>
<div>
<br />
</div>
<div>
Can anybody tell me how to solve this problem?
</div>
<div>
<br />
</div>
<div>
Dev Environment:
</div>
<div>
<span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;"> </span>Visual Studio 2017
</div>
<div>
<span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;"> </span>Android 7.0
</div>
<div>
<span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;"> </span>Android NDK64
<span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;">r13b</span>
</div>
<div>
<span style="font-family: ''; font-size: 10.5pt; line-height: 1.5; background-color: window;"> </span>Arch arm64-v8a
</div>
<div>
<br />
</div>
<div>
Best regards.
</div>
<div>
<br />
</div>
<div>
Glen
</div>
</div>
</div>
</blockquote>
<br />
</body>
</html>