Wednesday, July 18, 2012

Ogrekit for Android

I'm fond of 3D games and found an open-sourced game kit called "OgreKit" developed by an volunteer. It makes use of OpenGL ES 2.0 in Android and the popular rendering engine - Ogre 3D, to form a game engine. Ok, let's play around with it.

1. goto
2. follow the instruction to download the source code in Terminal of your linux box:

svn checkout gamekit-read-only

3. going into su: type "sudo su"
4. vim ~/.bashrc
5. add environment variables to the bash shell (.bashrc)

export PATH

export NDK

export NDK_BIN
6. restart Terminal and type "sudo su"
7. go into the "./gamekit-read-only/trunk" and type:
"./configure-android ../build_android" <- you use mkdir ../build_android first
8. cd ../build_android && make
9. after the lengthy compilation, the baked "" will be placed inside "./build_android/Samples/AndroidDemo/Shared"

Then, we can build an Android apps for using this JNI library.
1. copy to ./trunk/Samples/AndroidDemo/Demo/libs
2. Goto Eclipse -> New -> Android application from existing code ->
browser to "./trunk/Samples/AndroidDemo/Demo" and finished.
3. copy the asset folder's "asset/gk_android.blend" to /sdcard/gamekit/gk_android.blend.
4. build, download to device and RUN...Here we go!!


Updated 20120929::
A.)while checkout latest gamekit via
- svn checkout gamekit-read-only, the "trunk" folder have been removed by designer. And as you run "cmake-gui" by root user (i.e. sudo su) and configure the makefile, you can't setup the android NDK path any more. So, env. variable "OPENGLES2_INCLUDE_DIR" cannot be generated from the cmake, the workaround is by adding a line 
>>> "set(OPENGLES2_INCLUDE_DIR /home/henryl/android-ndk-r8/platforms/android-9/arch-arm/usr/include)
" inside ./gamekit_root/CMakeLists.txt to do so.

B.) And one more thing, is that while exec. ./configure-android ../build_android, an error 
missing "ANDROID_NDK" env. variable, so, we need to .... 
>>> vim ~/.bashrc
>>> add a line at the end

No comments:

Post a Comment