[osg-users] Android osgPlugins

Rafa Gaitan rafa.gaitan at gmail.com
Wed Apr 22 15:17:56 PDT 2015


Hello Christian,

Just to clarify a little bit the things:

- All the versions until 3.3.2 (I think that's the last one), should be
compiled using the old system (generating the Android.mk files through
cmake)

- Newer version must use the new Toolchain mechanism

Both methods are explained here:
http://www.openscenegraph.org/index.php/documentation/platform-specifics/android

Regarding the examples inside OSG, I don't know the current status, as far
as I know Jordi made them work but I usually use osgAndroid. FYI I changed
the repository of osgAndroid to github, seems that gitorious has been
absorbed by gitlab, so I moved it out. The new url is:
https://github.com/corsario/osgAndroid

Regarding the thirdparty dependencies with the new Toolchain, you are
right, is something I forgot to add into cmake when I was cleaning it up
for building for Android. I'll try to do it once I had some time.

On the other hand, you must build OSG either GLES1 or GLES2. If you build
it against GLES2 then you need to add your own shaders to see something on
screen, of course the example for GLES2 won't work if OSG was built with
GLES1 and the GLES1 example won't show anything if OSG was compiled with
GLES2, I apologize if this was already clarified :)

Best regards,
Rafa.


2015-04-22 21:59 GMT+02:00 Christian Kehl <Christian.Kehl at uni.no>:

> Christian Kehl <Christian.Kehl at ...> writes:
>
> >
> > Jordi Torres <jtorresfabra <at> ...> writes:
> >
> > >
> > >
> > > Hi Christian,
> > > I just compiled OSG for Android and executed the example with the fresh
> > build for GLES1 without major problems.
> > > What version of OSG are you running? Does the example shipped with OSG
> > works for you? Are you compiling using the toolchain?
> > >
> > >
> > >
> > >
> > >
> > > 2015-04-20 10:58 GMT+02:00 Jordi Torres
> > <jtorresfabra at ...>:
> > > Hi Christian, Jan et al.
> > > Sorry for not being too active.... Anyway, did you try to compile all
> with
> > the last additions from Rafa Gaitán? Now it is possible to compile OSG
> for
> > Android with dynamic libraries, take a look
> >
> to
> http://www.openscenegraph.org/index.php/documentation/platform-specifics/android/178-building-openscenegraph-for-android-3-4
> > .
> > > Is a must for you to use static libs? You can try the dynamic version,
> > maybe it solves your problems.
> > >
> > > Also we are using osgAndroid (
> https://gitorious.org/osgandroid/pages/Home
> > ) maybe it could be helpful.
> > >
> > > I'm building now OSG for Android to do some testing.
> > >
> > > I hope I can help a bit later.
> > >
> > >
> > >
> > >
> > > Do the osgAndroid examples shipped with OSG work for you? If those
> don't
> > work neither, then something has changed in OSG and broke it since
> mid-2013
> > when I have last compiled the Android version (and when it was working).
> > >
> > > J.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> >
> > Hi to everybody,
> >
> > it's comforting to see some activity going on. The last days, I was
> working
> > on another project, so please excuse my late reply too.
> >
> > I am using OpenSceneGraph 3.0.1. The GLES1 and GLES2 example shipped with
> > android are the ones that break (not load data). It's not a must-have
> for me
> > to use static linking - if dynamic linking would work, it would be fine
> for
> > me too. At the moment, I just like to see some model on my android
> >
> > I will try out osgAndroid and the 3.0.4 build - let's hope it resolves
> the
> > issue. Jordi - which version of the NDK are you using ? I have the r10
> NDK
> > installed. It may be good to know for tracking down the error.
> >
> > News are about to be reported soon. Best Regards,
> >
> > Christian
> >
> > _______________________________________________
> > osg-users mailing list
> > osg-users <at> lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
>
> So, I downloaded the 3.3.7 developer version of OpenSceneGraph and ran the
> cmake command as given in the link for "Building OpenSceneGraph 3.3.2-3.4.x
> for Android" (sth. like it).
>
> After a bit of hassle, it compiled fine.
> I also put the 3rdParty folder inside the OSG root folder, but cmake
> reported
> that CURL, Jpeg, Tiff etc. are missing - well, weird, but not urgent for
> now.
> I use the svn version rc2, and compile with OPENGL_PROFILE "GLES2".
>
> Then, I imported the GLES1/2 examples in Eclipse, modified the Android.mk
> so
> to link to the installation folder (btw: still used static libs) and using
> gnustl_static, ran ndk-build, and this is the output:
>
> christian at PROMETHEUS:~/workspace/Android/osgViewerGLES1_337$
> ${ANDROID_NDK}/ndk-build
> Android NDK: WARNING:jni/Android.mk:osgNativeLib: non-system libraries
> in linker flags:
> -lgnustl_static -lcurl -ljpeg -lgif -lpng -ltiff -losgdb_dds
> -losgdb_openflight -losgdb_tga -losgdb_rgb -losgdb_osgterrain -losgdb_osg
> -losgdb_ive -losgdb_deprecated_osgviewer -losgdb_deprecated_osgvolume
> -losgdb_deprecated_osgtext -losgdb_deprecated_osgterrain
> -losgdb_deprecated_osgsim -losgdb_deprecated_osgshadow
> -losgdb_deprecated_osgparticle -losgdb_deprecated_osgfx
> -losgdb_deprecated_osganimation -losgdb_deprecated_osg
> -losgdb_serializers_osgvolume -losgdb_serializers_osgtext
> -losgdb_serializers_osgterrain -losgdb_serializers_osgsim
> -losgdb_serializers_osgshadow -losgdb_serializers_osgparticle
> -losgdb_serializers_osgmanipulator -losgdb_serializers_osgfx
> -losgdb_serializers_osganimation -losgdb_serializers_osg -losgViewer
> -losgVolume -losgTerrain -losgText -losgShadow -losgSim -losgParticle
> -losgManipulator -losgGA -losgFX -losgDB -losgAnimation -losgUtil -losg
> -lOpenThreads
> Android NDK:     This is likely to result in incorrect builds. Try using
> LOCAL_STATIC_LIBRARIES
> Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library
> dependencies of the
> Android NDK:     current module
> Android NDK: WARNING:jni/Android.mk:osgNativeLib: non-system libraries in
> linker flags: -lgnustl_static -lcurl -ljpeg -lgif -lpng -ltiff -losgdb_dds
> -losgdb_openflight -losgdb_tga -losgdb_rgb -losgdb_osgterrain -losgdb_osg
> -losgdb_ive -losgdb_deprecated_osgviewer -losgdb_deprecated_osgvolume
> -losgdb_deprecated_osgtext -losgdb_deprecated_osgterrain
> -losgdb_deprecated_osgsim -losgdb_deprecated_osgshadow
> -losgdb_deprecated_osgparticle -losgdb_deprecated_osgfx
> -losgdb_deprecated_osganimation -losgdb_deprecated_osg
> -losgdb_serializers_osgvolume -losgdb_serializers_osgtext
> -losgdb_serializers_osgterrain -losgdb_serializers_osgsim
> -losgdb_serializers_osgshadow -losgdb_serializers_osgparticle
> -losgdb_serializers_osgmanipulator -losgdb_serializers_osgfx
> -losgdb_serializers_osganimation -losgdb_serializers_osg -losgViewer
> -losgVolume -losgTerrain -losgText -losgShadow -losgSim -losgParticle
> -losgManipulator -losgGA -losgFX -losgDB -losgAnimation -losgUtil -losg
> -lOpenThreads
> Android NDK:     This is likely to result in incorrect builds. Try using
> LOCAL_STATIC_LIBRARIES
> Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library
> dependencies of the
> Android NDK:     current module
> [armeabi] Compile++ thumb: osgNativeLib <= osgNativeLib.cpp
> [armeabi] Compile++ thumb: osgNativeLib <= OsgMainApp.cpp
> [armeabi] Compile++ thumb: osgNativeLib <= OsgAndroidNotifyHandler.cpp
> [armeabi] SharedLibrary  : libosgNativeLib.so
> jni/OsgMainApp.cpp:101: error: undefined reference to
> 'osgViewer::View::addEventHandler(osgGA::EventHandler*)'
> jni/OsgMainApp.cpp:102: error: undefined reference to
> 'osgViewer::View::addEventHandler(osgGA::EventHandler*)'
> jni/OsgMainApp.cpp:103: error: undefined reference to
> 'osgViewer::View::addEventHandler(osgGA::EventHandler*)'
> jni/OsgMainApp.cpp:104: error: undefined reference to
> 'osgViewer::View::addEventHandler(osgGA::EventHandler*)'
> collect2: error: ld returned 1 exit status
> make: *** [obj/local/armeabi/libosgNativeLib.so] Error 1
>
> Hence, the static linker does not find the function
> osgViewer::View::addEventHandler(...) in the library. This is the GLES1
> example. I guess it is no surprise it doesn't find THAT (shouldn't it be
> osgViewer::Viewer::addEventHandler ?!), rather the question is where this
> is
> coded ? I assume there must be sth. going on in the DOTOSGWRAPPER of
> osgViewer ...
>
> The output for the osgViewerGLES2, configured and setup the same way, looks
> as follows:
>
> christian at PROMETHEUS:~/workspace/Android/osgViewer_337$
> ${ANDROID_NDK}/ndk-build
> Android NDK: WARNING:jni/Android.mk:osgNativeLib: non-system libraries in
> linker flags: -lgnustl_static -lcurl -ljpeg -lgif -lpng -ltiff -losgdb_dds
> -losgdb_openflight -losgdb_tga -losgdb_rgb -losgdb_osgterrain -losgdb_osg
> -losgdb_ive -losgdb_deprecated_osgviewer -losgdb_deprecated_osgvolume
> -losgdb_deprecated_osgtext -losgdb_deprecated_osgterrain
> -losgdb_deprecated_osgsim -losgdb_deprecated_osgshadow
> -losgdb_deprecated_osgparticle -losgdb_deprecated_osgfx
> -losgdb_deprecated_osganimation -losgdb_deprecated_osg
> -losgdb_serializers_osgvolume -losgdb_serializers_osgtext
> -losgdb_serializers_osgterrain -losgdb_serializers_osgsim
> -losgdb_serializers_osgshadow -losgdb_serializers_osgparticle
> -losgdb_serializers_osgmanipulator -losgdb_serializers_osgfx
> -losgdb_serializers_osganimation -losgdb_serializers_osg -losgViewer
> -losgVolume -losgTerrain -losgText -losgShadow -losgSim -losgParticle
> -losgManipulator -losgGA -losgFX -losgDB -losgAnimation -losgUtil -losg
> -lOpenThreads
> Android NDK:     This is likely to result in incorrect builds. Try using
> LOCAL_STATIC_LIBRARIES
> Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library
> dependencies of the
> Android NDK:     current module
> Android NDK: WARNING:jni/Android.mk:osgNativeLib: non-system libraries in
> linker flags: -lgnustl_static -lcurl -ljpeg -lgif -lpng -ltiff -losgdb_dds
> -losgdb_openflight -losgdb_tga -losgdb_rgb -losgdb_osgterrain -losgdb_osg
> -losgdb_ive -losgdb_deprecated_osgviewer -losgdb_deprecated_osgvolume
> -losgdb_deprecated_osgtext -losgdb_deprecated_osgterrain
> -losgdb_deprecated_osgsim -losgdb_deprecated_osgshadow
> -losgdb_deprecated_osgparticle -losgdb_deprecated_osgfx
> -losgdb_deprecated_osganimation -losgdb_deprecated_osg
> -losgdb_serializers_osgvolume -losgdb_serializers_osgtext
> -losgdb_serializers_osgterrain -losgdb_serializers_osgsim
> -losgdb_serializers_osgshadow -losgdb_serializers_osgparticle
> -losgdb_serializers_osgmanipulator -losgdb_serializers_osgfx
> -losgdb_serializers_osganimation -losgdb_serializers_osg -losgViewer
> -losgVolume -losgTerrain -losgText -losgShadow -losgSim -losgParticle
> -losgManipulator -losgGA -losgFX -losgDB -losgAnimation -losgUtil -losg
> -lOpenThreads
> Android NDK:     This is likely to result in incorrect builds. Try using
> LOCAL_STATIC_LIBRARIES
> Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library
> dependencies of the
> Android NDK:     current module
> [armeabi] Compile++ thumb: osgNativeLib <= osgNativeLib.cpp
> [armeabi] Compile++ thumb: osgNativeLib <= OsgMainApp.cpp
> [armeabi] Compile++ thumb: osgNativeLib <= OsgAndroidNotifyHandler.cpp
> [armeabi] SharedLibrary  : libosgNativeLib.so
> jni/OsgMainApp.cpp:113: error: undefined reference to
> 'osgViewer::View::addEventHandler(osgGA::EventHandler*)'
> jni/OsgMainApp.cpp:114: error: undefined reference to
> 'osgViewer::View::addEventHandler(osgGA::EventHandler*)'
> jni/OsgMainApp.cpp:115: error: undefined reference to
> 'osgViewer::View::addEventHandler(osgGA::EventHandler*)'
> jni/OsgMainApp.cpp:116: error: undefined reference to
> 'osgViewer::View::addEventHandler(osgGA::EventHandler*)'
> /media/christian/DATA/OpenSceneGraph301/include/osg/State:555: error:
> undefined reference to 'glColor4f'
> /media/christian/DATA/OpenSceneGraph301/include/osg/State:646: error:
> undefined reference to 'glEnableClientState'
> /media/christian/DATA/OpenSceneGraph301/include/osg/State:651: error:
> undefined reference to 'glVertexPointer'
> /media/christian/DATA/OpenSceneGraph301/include/osg/State:859: error:
> undefined reference to 'glDisableClientState'
> /media/christian/DATA/OpenSceneGraph301/include/osg/State:1062: error:
> undefined reference to 'glEnableClientState'
> /media/christian/DATA/OpenSceneGraph301/include/osg/State:1066: error:
> undefined reference to 'glTexCoordPointer'
> /media/christian/DATA/OpenSceneGraph301/include/osg/State:828: error:
> undefined reference to 'glEnableClientState'
> /media/christian/DATA/OpenSceneGraph301/include/osg/State:833: error:
> undefined reference to 'glColorPointer'
> /media/christian/DATA/OpenSceneGraph301/include/osg/State:565: error:
> undefined reference to 'glNormal3f'
> /media/christian/DATA/OpenSceneGraph301/include/osg/State:737: error:
> undefined reference to 'glEnableClientState'
> /media/christian/DATA/OpenSceneGraph301/include/osg/State:742: error:
> undefined reference to 'glNormalPointer'
> /media/christian/DATA/OpenSceneGraph301/include/osg/State:859: error:
> undefined reference to 'glDisableClientState'
> /media/christian/DATA/OpenSceneGraph301/src/osgParticle/Particle.cpp:231:
> error: undefined reference to 'glColor4f'
> /media/christian/DATA/OpenSceneGraph301/src/osgParticle/Particle.cpp:232:
> error: undefined reference to 'glPushMatrix'
> /media/christian/DATA/OpenSceneGraph301/src/osgParticle/Particle.cpp:233:
> error: undefined reference to 'glTranslatef'
> /media/christian/DATA/OpenSceneGraph301/src/osgParticle/Particle.cpp:238:
> error: undefined reference to 'glMultMatrixf'
> /media/christian/DATA/OpenSceneGraph301/src/osgParticle/Particle.cpp:244:
> error: undefined reference to 'glPopMatrix'
> [...]
> /media/christian/DATA/OpenSceneGraph301/src/osg/ArrayDispatchers.cpp:29:
> error: undefined reference to 'glColor4f'
> /media/christian/DATA/OpenSceneGraph301/src/osg/ArrayDispatchers.cpp:25:
> error: undefined reference to 'glColor4ub'
> /media/christian/DATA/OpenSceneGraph301/src/osg/ArrayDispatchers.cpp:34:
> error: undefined reference to 'glNormal3f'
> /media/christian/DATA/OpenSceneGraph301/src/osg/ArrayDispatchers.cpp:33:
> error: undefined reference to 'glNormal3f'
> collect2: error: ld returned 1 exit status
> make: *** [obj/local/armeabi/libosgNativeLib.so] Error 1
>
> Also there, it doesn't find the osgViewer::View::add..., but he also looks
> for the GLES1 fixed functionality pipeline calls that surely don't exist.
> The question for the is rather why the GLES2 example (I swear by god, it is
> the GLES2 example), asks for GLES1 functions ?!
>
> This is how far I got today. Any help would be highly appreciated. I also
> append my cmake-line.
>
> cmake .. -DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF
> -DDYNAMIC_OPENSCENEGRAPH=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF
> -DOSG_GL_MATRICES_AVAILABLE=OFF -DOSG_GL_VERTEX_FUNCS_AVAILABLE=OFF
> -DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE=OFF
> -DOSG_GL_FIXED_FUNCTION_AVAILABLE=OFF -DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF
> -DOSG_GL1_AVAILABLE=OFF -DOSG_GL2_AVAILABLE=OFF -DOSG_GL3_AVAILABLE=OFF
> -DOSG_GLES1_AVAILABLE=OFF -DOSG_GLES2_AVAILABLE=ON
> -DCMAKE_INSTALL_PREFIX=$HOME/android_install -DCMAKE_BUILD_TYPE=Release
> -DCMAKE_TOOLCHAIN_FILE=/media/christian/DATA/OpenSceneGraph337
> /PlatformSpecifics/Android/android.toolchain.cmake
> -DOPENGL_PROFILE="GLES2"
>
> Tomorrow, I go and try the osgAndroid repo out.
>
> Best Regards already,
>
> Christian
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Rafael Gaitán Linares
CTO at Mirage Technologies S.L - http://www.mirage-tech.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150423/75a711eb/attachment-0003.htm>


More information about the osg-users mailing list