Re: [osg-users] Android and a mix of Java + native C++ now possible
Albino Rodrigues wrote: Hi, I am currently in the process of doing a test port of an OSG application we have here to Odroid - ODROID_WEBSITE. It is basically an entertainment device built on top of Android 2.1. While going through the Android toolchain documentation for the latest NDK (rev3) I noticed two critical points. No standard C++ library support: The Android 1.5 system does not use any C++ standard library, and does not provide one to applicative native code. Instead, a very limited set of headers are provided (see docs/STABLE-APIS.TXT) which correspond to the C++ support code used to build the Android platform. It is possible to hack existing C++ STL implementations to work on top of this, but this is not supported yet. We recommend trying with uSTL and STLport at this point if you really need this. No support for C++ exceptions and RTTI: --- The Android 1.5 system image lacks several features necessary to reliably implement C++ exceptions and RTTI. C++ code that depends on these features will simply not link or run appropriately on Android 1.5 I'm curious if anyone has worked with Android's NDK and OSG and has a work around or other ideas. I found WEBSITE_WITH_PATCH which adds exceptions, STL and RTTI but reading through the android google groups people are having issues with it. Is this the modified NDK you mean: http://www.crystax.net/android/ndk-r3.php It includes a full STL implementation. I tried adding STLport to the release NDK, but it was problematic at best. A much easier solution was to use this modified NDK. I also was able to set up a CMake toolchain for OSG that looked like it was on the way to working. I hit a brick wall when I got to osgGA. (This is a third critical point that you didn't mention :-) ) At some point, you need to define your Activity in Java and make the calls from there to the native code. You also need to somehow create a GLSurfaceView (usually done in a second Java class). I didn't have time to explore these issues yet. The iPhone gets this stuff for free because OSG already has the necessary backend code to create OSX windows and contexts. I'll attach the CMake toolchain file for the Android NDK in case it's useful... --J set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_VERSION 1) set(CMAKE_SYSTEM_PROCESSOR arm-elf) set(CMAKE_C_LINK_FLAGS -nostdlib) set(CMAKE_CXX_LINK_FLAGS -nostdlib) set(CMAKE_CXX_COMPILER /irl/work/jdaly/android/android-ndk-r3-crystax/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-gcc) set(CMAKE_CXX_COMPILER /irl/work/jdaly/android/android-ndk-r3-crystax/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-c++) set(CMAKE_ROOT_PATH /irl/work/jdaly/android/android-ndk-r3-crystax/build/prebuilt/linux -x86/arm-eabi-4.4.0/bin) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Android and a mix of Java + native C++ now possible
Hi Jason, Thanks for sharing your experience and your CMake :) Yes, that's the modified NDK I was referring to. Damn, I completely forgot about osgGA and didn't know about GLSurfaceView (I'm new to the Android SDK). Cheers, Albino -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=27644#27644 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Android and a mix of Java + native C++ now possible
Albino Rodrigues wrote: Hi Jason, Thanks for sharing your experience and your CMake :) Yes, that's the modified NDK I was referring to. Damn, I completely forgot about osgGA and didn't know about GLSurfaceView (I'm new to the Android SDK). Yeah, I had even read all the docs and done a couple of tutorials, but I still totally forgot about the whole Activity/View issue until I was actually compiling OSG. :-) I think it's a workable problem, but I haven't had time to think about it since then. The Qt capability that Martin mentioned might be an interesting avenue to explore. --J ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Android and a mix of Java + native C++ now possible
Hi, I am currently in the process of doing a test port of an OSG application we have here to Odroid - ODROID_WEBSITE. It is basically an entertainment device built on top of Android 2.1. While going through the Android toolchain documentation for the latest NDK (rev3) I noticed two critical points. No standard C++ library support: The Android 1.5 system does not use any C++ standard library, and does not provide one to applicative native code. Instead, a very limited set of headers are provided (see docs/STABLE-APIS.TXT) which correspond to the C++ support code used to build the Android platform. It is possible to hack existing C++ STL implementations to work on top of this, but this is not supported yet. We recommend trying with uSTL and STLport at this point if you really need this. No support for C++ exceptions and RTTI: --- The Android 1.5 system image lacks several features necessary to reliably implement C++ exceptions and RTTI. C++ code that depends on these features will simply not link or run appropriately on Android 1.5 I'm curious if anyone has worked with Android's NDK and OSG and has a work around or other ideas. I found WEBSITE_WITH_PATCH which adds exceptions, STL and RTTI but reading through the android google groups people are having issues with it. Cheers, bino ps: Sorry I can't post the full URL due to the forums spam filters (You must have 2 posts before you can post URL's/Links.) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=27547#27547 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Android and a mix of Java + native C++ now possible
And it can now do Qt Martin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=27548#27548 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Android and a mix of Java + native C++ now possible
This morning I came across a new article about the newly released Android 1.5 Android Native Development Kit (NDK): http://developer.android.com/sdk/ndk/1.5_r1/index.html What this looks like is that we'll be able to mix native C/C++ code with a Java application. In the case of the OpenSceneGraph there is chance that it might make it possible to have the scene graph in C++ and the higher level viewer code in Java. The OpenSceneGraph would have to work under OpenGL ES, but that's on cards for other projects anyway, so it perhaps it might one day be possible to write OpenSceneGaph apps for Android devices. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org