Hi All
I've been playing around with the zip plugin in order to read files from my
apk file on Android. Apk is basically a zipped up version of your app with
all the assets etc inside.
This is now working fine while directly reading images, .osg files and
fonts, however I have two issues.
1. Images referenced by the .osg are not loaded, for example if my model is
in 'pkg.apk/assets/Models/model1.osg' and it references
'images\\diffuse.png' then the image is not loaded. I have tried moving the
image to the root of the archive in/not in an images folder but it never
seems to load.
2. I use osgDB XmlPasser quite a bit for simple meta data stuff. Is there a
way to read an xml file from and archive? I usually read my xml files like
so
osgDB::XmlNode::Input input;
input.open(foundFile);
input.readAllDataIntoBuffer();
osg::ref_ptr<osgDB::XmlNode> root = new osgDB::XmlNode;
root->read(input);
osgDB::XmlNode::Input has stream reading methods, but is it possible to
get access to an archive file as a stream?
Cheers
Tom
PS
For those interested here is how I get the zip plugin to read the apk
osgDB::Registry::instance()->addFileExtensionAlias("apk" , "zip");
osgDB::ReaderWriter* zipReader =
osgDB::Registry::instance()->getReaderWriterForExtension("zip");
if(zipReader)
{
zipReader->supportsExtension("apk", "Android package");
if(zipReader->acceptsExtension("apk"))
{
OSG_FATAL << "ZIP Plugin supports apk" << std::endl;
}else{
OSG_FATAL << "ZIP Plugin does not support apk!" << std::endl;
}
}else{
OSG_FATAL << "No ZIP Plugin!" << std::endl;
}
osg::ref_ptr<osgDB::Archive>_archive = osgDB::openArchive(pathToApk,
osgDB::Archive::READ);
To get the path to the apk use this in java and pass to c++ via jni stuff.
Context context = getApplicationContext(); // or other way of
getting current contex
String dir = context.getFilesDir().getPath();
String pathToApk = context.getPackageResourcePath();
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org