1

On iOS/windows I can create a osg::Image object by this:

     osg::ref_ptr<osg::Image> icon = osgDB::readRefImageFile(filePath);

the filePath param could be the "Resource/a.png", which is a relative path in the project. but this could not work in Android. I also tried using an absolute path like:

"/storage/emulated/0/res/a.png"

the path was the full sd card path to a.png, but didn't work either.

The Image object was used to be the icon of a osgEarth::Annotation::PlaceNode:

osg::ref_ptr<osg::Image> icon = osgDB::readRefImageFile(filePath);
node->setIconImage(icon.get());

On iOS, the icon could be displayed, but didn't display on Android. I am certain the problem was the osg::Image object didn't create properly on Android.

I appreciate very much if anyone could help. Thanks.

0 Answers0