[osg-users] Android osgPlugins

Christian Kehl Christian.Kehl at uni.no
Wed Apr 15 07:15:55 PDT 2015


Jan Ciger <jan.ciger at ...> writes:

> 
> 
> 
> On Mon, Apr 13, 2015 at 11:16 AM, Christian Kehl <Christian.Kehl <at>
uni.no> wrote:Hi Jordi,
> I encounter the same problem in the same situation. I've build OSG for
> Android in static mode (only way it even compiles), all static libraries
> (for me: .a-files) are in my local installation folder, together with the
> libraries for armeabi and armeabi-v7a from the Android Native Developer Kit.
> It compiles fine, I can change the background of the viewer without
> problems, but it just doesn't wanna load the models. I get the same logcat
> messages as mentioned before (not finding the plugins). I, up until now,
> loaded files from the internal HDD of the phone (I am on Nexus 5), but today
> also try out the sdcard as source. Are there any suggestions how to solve
> the problem ?
> 
> 
> 
> 
> Did you:
> 
> a) Link the plugins into your JNI code? This is needed because the
libraries are static, thus it cannot load them dynamically at runtime. It is
a workaround for complicated deployment on Android. 
> 
> b) Declared which plugins you are using? Again, this is linked to the
point above, because the plugin registration has to be done at compile time
when using static linking. Make sure that you have something like this in
your code (add/remove the plugins you need/don't need):
> //Static plugins
> MacroUSE_OSGPLUGIN(ive)
> USE_OSGPLUGIN(osg)
> USE_OSGPLUGIN(osg2)
> USE_OSGPLUGIN(freetype)
> //USE_OSGPLUGIN(terrain)
> USE_OSGPLUGIN(rgb)//
> USE_OSGPLUGIN(OpenFlight)
> //USE_OSGPLUGIN(dds)
> //Static
> DOTOSGUSE_DOTOSGWRAPPER_LIBRARY(osg)
> //USE_DOTOSGWRAPPER_LIBRARY(osgFX)
> //USE_DOTOSGWRAPPER_LIBRARY(osgParticle)
> //USE_DOTOSGWRAPPER_LIBRARY(osgTerrain)
> USE_DOTOSGWRAPPER_LIBRARY(osgText)
> USE_DOTOSGWRAPPER_LIBRARY(osgAnimation)
> //USE_DOTOSGWRAPPER_LIBRARY(osgViewer)
> //USE_DOTOSGWRAPPER_LIBRARY(osgVolume)
> //Static serializer
> USE_SERIALIZER_WRAPPER_LIBRARY(osg)
> USE_SERIALIZER_WRAPPER_LIBRARY(osgAnimation)
> //USE_SERIALIZER_WRAPPER_LIBRARY(osgFX)
> USE_SERIALIZER_WRAPPER_LIBRARY(osgManipulator)
> //USE_SERIALIZER_WRAPPER_LIBRARY(osgParticle)
> //USE_SERIALIZER_WRAPPER_LIBRARY(osgTerrain)
> USE_SERIALIZER_WRAPPER_LIBRARY(osgText)
> //USE_SERIALIZER_WRAPPER_LIBRARY(osgVolume)
> 
> Without this sort of declaration and the corresponding linking statement
it will not work when built as a fully static library. 
> 
> J.


Hi,

I had a look on the OsgMainApp.hpp, where these plugin links are all active
(looks as follows):

//Static plugins Macro
USE_OSGPLUGIN(ive)
USE_OSGPLUGIN(osg)
USE_OSGPLUGIN(osg2)
USE_OSGPLUGIN(terrain)
USE_OSGPLUGIN(rgb)
USE_OSGPLUGIN(OpenFlight)
USE_OSGPLUGIN(dds)
//Static DOTOSG
USE_DOTOSGWRAPPER_LIBRARY(osg)
USE_DOTOSGWRAPPER_LIBRARY(osgFX)
USE_DOTOSGWRAPPER_LIBRARY(osgParticle)
USE_DOTOSGWRAPPER_LIBRARY(osgTerrain)
USE_DOTOSGWRAPPER_LIBRARY(osgText)
USE_DOTOSGWRAPPER_LIBRARY(osgViewer)
USE_DOTOSGWRAPPER_LIBRARY(osgVolume)
//Static serializer
USE_SERIALIZER_WRAPPER_LIBRARY(osg)
USE_SERIALIZER_WRAPPER_LIBRARY(osgAnimation)
USE_SERIALIZER_WRAPPER_LIBRARY(osgFX)
USE_SERIALIZER_WRAPPER_LIBRARY(osgManipulator)
USE_SERIALIZER_WRAPPER_LIBRARY(osgParticle)
USE_SERIALIZER_WRAPPER_LIBRARY(osgTerrain)
USE_SERIALIZER_WRAPPER_LIBRARY(osgText)
USE_SERIALIZER_WRAPPER_LIBRARY(osgVolume)

if one of them would go wrong, my JNI-compiler would mourn, I presume ?
Hence, the links are active, still the models are not loaded.

At the moment, I follow this approach:
go on the commandline to my workdirectory, 
execute "<path-to-ndk>/ndk-build", then go to eclipse, 
hit "start" and try out the app. 
May that be a cause for problems ?




More information about the osg-users mailing list