OSG on Android

1.     Building OSG on Android

  • Unzipp osg  in C :
  • Unzipp 3rd party folder inside osg folder.
  • Create a new folder in C :  OpenSceneGraph-3.0.1-build
  • Create a new folder in C :  OpenSceneGraph-3.0.1-install
  • Create a file named build.sh  in OpenSceneGraph-3.0.1-build having the following content :
PATH=.
PATH=$PATH:/usr/local/bin:/mingw/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/Ant/bin
PATH=$PATH:"/c/Program Files/Java/jdk1.7.0_03/bin/":/c/android/android-sdk/tools:/c/android/android-sdk/platform-tools:/c/android/ndk
export PATH
CXX=c:/mingw/bin/g++.exe CC=c:/mingw/bin/gcc.exe  "c:/Progra~1/CMake 2.8/bin/cmake" ../OpenSceneGraph-3.0.1 -G "Eclipse CDT4 - MinGW Makefiles"  --debug-output -DCMAKE_INSTALL_PREFIX="c:/OpenSceneGraph-3.0.1-install" -DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF -DDYNAMIC_OPENSCENEGRAPH=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF -DOSG_GL_MATRICES_AVAILABLE=ON -DOSG_GL_VERTEX_FUNCS_AVAILABLE=ON -DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE=ON -DOSG_GL_FIXED_FUNCTION_AVAILABLE=ON -DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF -DOSG_GL1_AVAILABLE=OFF -DOSG_GL2_AVAILABLE=OFF -DOSG_GL3_AVAILABLE=OFF -DOSG_GLES1_AVAILABLE=ON -DOSG_GLES2_AVAILABLE=OFF
  • Open msys in the OpenSceneGraph-3.0.1-build folder  and then execute  ./build.sh
  • Execute mingw32-make install (you may need to delete “wordlist” in the Android source)

2.     Compilation of osgAndroidExampleGLES1 (include in the osg folder)

  • Open the project in Eclipse
  • Edit Android.mk :
    • Line 7 :
      OSG_ANDROID_DIR       := < type your install directory >

In our case it’s ” /c/OpenSceneGraph-3.0.1-install ”

  • Line 21 : replace it by
LOCAL_LDLIBS    := -llog -lGLESv1_CM -ldl -lz -lgnustl_static
  • Open cygwin and in the folder osgAndroidExampleGLES1 execute this command to update build.xml :
$ANDROID_SDK/tools/android.bat list targets
  • Review the list of target Android and save the ID, in our case it’s number 1. Execute the following command:
$ANDROID_SDK/tools/android.bat update project -t 1 -p . -s
  • Now we open Msys and go through the folder osgAndroidExampleGLES1 in the workspace and execute
$ANDROID_NDK/ndk-build

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s