OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

osg plugin couldn't load an osgb or ive file on Android system


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
first_gle
Newbie


Joined: 30 Mar 2017
Posts: 6

PostPosted: Sat May 27, 2017 3:52 am    Post subject:
osg plugin couldn't load an osgb or ive file on Android system
Reply with quote

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





Quote:

From: 龚来恩 (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
Date: 2017-05-26 14:06
To: OpenSceneGraph Users (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
Subject: A problem with regard to std:istream on Android


Hi 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 code
osg::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.cpp
virtual 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 2017
Android 7.0
Android NDK64 r13b
Arch arm64-v8a


Best regards.


Glen



Quote:







------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
first_gle
Newbie


Joined: 30 Mar 2017
Posts: 6

PostPosted: Sat May 27, 2017 5:17 am    Post subject:
osg plugin couldn't load an osgb or ive file on Android system
Reply with quote

Quote:
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





Quote:

From: 龚来恩 (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
Date: 2017-05-26 14:06
To: OpenSceneGraph Users (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
Subject: A problem with regard to std:istream on Android


Hi 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 code
osg::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.cpp
virtual 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 2017
Android 7.0
Android NDK64 r13b
Arch arm64-v8a


Best regards.


Glen



Quote:









------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
来恩
Guest





PostPosted: Sat May 27, 2017 5:20 am    Post subject:
osg plugin couldn't load an osgb or ive file on Android system
Reply with quote

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




Quote:

From: 龚来恩 (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
Date: 2017-05-26 14:06
To: OpenSceneGraph Users (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
Subject: A problem with regard to std:istream on Android


Hi 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 code
osg::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.cpp
virtual 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 2017
Android 7.0
Android NDK64 r13b
Arch arm64-v8a

Best regards.

Glen




------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Adding WOFF extension to freetype plugin robertosfield Submission 0 Mon Jul 17, 2017 3:48 pm View latest post
No new posts Error with InputStream reading osgb f... Riccardo Corsi General 28 Thu Jun 08, 2017 11:20 am View latest post
No new posts Does osgb file has compatible issues ... saedrna1 General 3 Tue Jun 06, 2017 12:01 pm View latest post
No new posts Render point cloud in a different coo... Bruno Oliveira General 1 Mon Jun 05, 2017 1:50 pm View latest post
No new posts how to convert osgb files to old version Haojia General 1 Fri Jun 02, 2017 4:35 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP