<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><style>body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; }div.foxdiv20170527131156603388 { }body { font-size: 10.5pt; font-family: 'Microsoft YaHei UI'; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<div><span></span></div><blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;"><div><div class="FoxDiv20170527131156603388"><div>Hello,</div><div><span style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">    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><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><span style="background-color: window; font-family: ''; font-size: 10.5pt; line-height: 1.5;"><br></span></div><div>Thank you in advance!</div><div><span style="background-color: window; font-family: ''; font-size: 10.5pt; line-height: 1.5;">Glen </span></div>
<div><br></div><hr style="width: 210px; height: 1px;" color="#b5c4df" size="1" align="left">
<div><span><div style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE: 10pt"><div>8802661@qq.com</div></div></span></div>
<blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;"><div> </div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm"><div style="PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SIZE: 12px;FONT-FAMILY:tahoma;COLOR:#000000; BACKGROUND: #efefef; PADDING-BOTTOM: 8px; PADDING-TOP: 8px"><div><b>From:</b> <a href="mailto:8802661@qq.com">龚来恩</a></div><div><b>Date:</b> 2017-05-26 14:06</div><div><b>To:</b> <a href="mailto:osg-users@lists.openscenegraph.org">OpenSceneGraph Users</a></div><div><b>Subject:</b> [osg-users] A problem with regard to std:istream on Android</div></div></div><div><div class="FoxDiv20170527113421797273">
<div><span></span>Hi All,</div><div><span style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">    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 style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'=""><span style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">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 style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">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 style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">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><br></div><div><br><blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;"><div>
<div>_______________________________________________</div>
<div>osg-users mailing list</div>
<div>osg-users@lists.openscenegraph.org</div>
<div>http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</div>
</div></blockquote>
</div></div></div></blockquote>
</div></div></blockquote>
</body></html>