Improving Android support
- Wolfmanfx
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
- Contact:
Re: Improving Android support
@Brocan
After the command line tool you could run CMake UI and point to zlib which i precompiled and then press configure.
@All
Maybe this will make into 1.8.1 so i can prepare a precompiled SDK for android.
After the command line tool you could run CMake UI and point to zlib which i precompiled and then press configure.
@All
Maybe this will make into 1.8.1 so i can prepare a precompiled SDK for android.
- Brocan
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
Re: Improving Android support
adding before looking for dependencies:Wolfmanfx wrote:@Brocan
After the command line tool you could run CMake UI and point to zlib which i precompiled and then press configure.
@All
Maybe this will make into 1.8.1 so i can prepare a precompiled SDK for android.
Code: Select all
if(ANDROID)
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER )
endif()
Now freezes before looking for CG
- Wolfmanfx
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
- Contact:
Re: Improving Android support
Ah i see i think i solved this - its commited plz test it
- Brocan
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
Re: Improving Android support
Yeah, it works perfect. Now the cmake execution freezes after "Looking for CG"Wolfmanfx wrote:Ah i see i think i solved this - its commited plz test it
I'm currently compiling, it takes a while, I'm getting a warning: "unrecognized command line option "-Wno-used-but-set-parameter".
Edit: crash while compiling sample browser
Code: Select all
...
Linking CXX static library ..\..\lib\libSample_SSAO.a
[100%] Built target Sample_SSAO
Scanning dependencies of target SampleBrowserDummy
[100%] Building CXX object Samples/Browser/CMakeFiles/SampleBrowserDummy.dir/dummy.cpp.o
Linking CXX shared module ..\..\lib\libSampleBrowserDummy.so
"android" is not recognized as external or internal command, program or batch file.
NMAKE : fatal error U1077: 'android' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
- Wolfmanfx
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
- Contact:
Re: Improving Android support
Yeah the command android, ant, ndk-build must be in your PATH env var.
edit: There is a folder called SampleBrowserNDK in your build dir you can navigate to this dir and call ndk-build
edit: There is a folder called SampleBrowserNDK in your build dir you can navigate to this dir and call ndk-build
- Brocan
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
Re: Improving Android support
"android" is an executable from NDK? or it refers to Android.mk?Wolfmanfx wrote:Yeah the command android, ant, ndk-build must be in your PATH env var.
edit: There is a folder called SampleBrowserNDK in your build dir you can navigate to this dir and call ndk-build
I suppose that ant is the "ant build system", right? http://ant.apache.org/
- Wolfmanfx
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
- Contact:
Re: Improving Android support
Here a small intro to android binary http://developer.android.com/guide/deve ... dline.html
And yes i mean ant.
But maybe you should use nvidia package http://developer.nvidia.com/sites/defau ... 749879.exe
And yes i mean ant.
But maybe you should use nvidia package http://developer.nvidia.com/sites/defau ... 749879.exe
- Brocan
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
Re: Improving Android support
Oh, thanks for the links. The whole android programs i've made were started from eclipse, and the ndk ones from scratch, i didn't know this tool.Wolfmanfx wrote:Here a small intro to android binary http://developer.android.com/guide/deve ... dline.html
And yes i mean ant.
But maybe you should use nvidia package http://developer.nvidia.com/sites/defau ... 749879.exe
I will try it tomorrow! thanks!
- Brocan
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
Re: Improving Android support
Ok, now its compiled
Next step, ant, i can't find any build.xml to feed it, where is supposed to be?
Code: Select all
[ 55%] Built target OgreMain
[ 66%] Built target RenderSystem_GLES2
[ 67%] Built target Plugin_OctreeSceneManager
[ 72%] Built target Plugin_ParticleFX
[ 83%] Built target OgreRTShaderSystem
[ 83%] Built target Sample_BezierPatch
[ 83%] Built target Sample_CameraTrack
[ 83%] Built target Sample_Character
[ 83%] Built target Sample_Compositor
[ 83%] Built target Sample_DualQuaternion
[ 84%] Built target Sample_DynTex
[ 84%] Built target Sample_FacialAnimation
[ 84%] Built target Sample_Grass
[ 85%] Built target Sample_Instancing
[ 85%] Built target Sample_Lighting
[ 86%] Built target Sample_NewInstancing
[ 86%] Built target Sample_Ocean
[ 87%] Built target Sample_ParticleFX
[ 88%] Built target Sample_ShaderSystem
[ 88%] Built target Sample_ShaderSystemMultiLight
[ 89%] Built target Sample_Shadows
[ 89%] Built target Sample_SkeletalAnimation
[ 89%] Built target Sample_SkyBox
[ 89%] Built target Sample_SkyDome
[ 90%] Built target Sample_SkyPlane
[ 90%] Built target Sample_Smoke
[ 90%] Built target Sample_SphereMapping
[ 90%] Built target Sample_TextureFX
[ 91%] Built target Sample_TextureArray
[ 91%] Built target Sample_Transparency
[ 92%] Built target Sample_VolumeTex
[ 93%] Built target Sample_Water
[ 94%] Built target Sample_BSP
[ 95%] Built target Sample_CelShading
[ 98%] Built target Sample_DeferredShading
[ 99%] Built target Sample_CubeMapping
[ 99%] Built target Sample_Dot3Bump
[ 99%] Built target Sample_Fresnel
[ 99%] Built target Sample_Isosurf
[ 99%] Built target Sample_ParticleGS
[100%] Built target Sample_SSAO
[100%] Built target SampleBrowserDummy
-
- Gnoblar
- Posts: 8
- Joined: Wed May 23, 2012 6:09 am
Re: Improving Android support
hi Brocan ,
Are you running successfully under windows by using eclipse?Could you teach me how to do it ? Now, I‘m nonplussed over anything. Thank you for that.
Are you running successfully under windows by using eclipse?Could you teach me how to do it ? Now, I‘m nonplussed over anything. Thank you for that.
- Brocan
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
Re: Improving Android support
Hi Liu Xinya,Liu Xinya wrote:hi Brocan ,
Are you running successfully under windows by using eclipse?Could you teach me how to do it ? Now, I‘m nonplussed over anything. Thank you for that.
Not, i'm not using eclipse at all, at the moment i'm compiling it from command line. Once i'll successfully compiled it from cmd, i will try to it from create a project for eclipse.
For "make" program i'm using nmake, which is provided by visual studio, so you need to have:
- An installation of visual studio (no matter if Pro or Express edition, both works).
- An installation of cmake, and cmake executable must be in your path environment var.
- An installation of ant, and ant executable must be in your path environment var.
- An environment variable named "ANDROID_NDK" pointing to your root NDK path (for example: "D:/Projects/Android/NDK")
- An environment variable named "ANDROID_SDK" pointing to your root SDK path (for example: "D:/Projects/Android/SDK")
- The path to "SDK/tools/android.bat" in your path environment var (for example: "D:/Projects/Android/SDK/tools")
- The path to "NDK" in your path environment var
After that:
- Go to start > all programs > visual studio XXX > Visual Studio Tools (this folder is only created in pro versions) > Visual studio command prompt (or Visual studio system symbol, i don't know what is the name in english installations).
- Checkout the Wolfmanfx trunk, and put in where you want (for example "D:/Projects/Android/OgreAndroidSrc").
- Download the dependencies, and put it in your ogre source root (for example "D:/Projects/Android/OgreAndroidSRC/AndroidDependencies")
- Create a folder where you are going to do the compilation (for example "D:/Projects/Android/OgreAndroidSRC/build")
- In the visual studio prompt, navigate to this folder ( "D:/Projects/Android/OgreAndroidSRC/build")
- Here, execute the following command:
Code: Select all
cmake .. -G "NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE="../CMake/toolchain/android.toolchain.cmake" -DOGRE_DEPENDENCIES_DIR="../AndroidDependencies" -DTargetPlatform="Android" -DOGRE_BUILD_RENDERSYSTEM_GLES2=TRUE -DOGRE_STATIC=TRUE -DANDROID_NATIVE_API_LEVEL=14 -DOGRE_BUILD_COMPONENT_PAGING=FALSE -DOGRE_BUILD_COMPONENT_TERRAIN=FALSE -DOGRE_BUILD_COMPONENT_RTSHADERSYSTEM=TRUE -DOGRE_BUILD_PLUGIN_BSP=FALSE -DOGRE_BUILD_PLUGIN_PCZ=FALSE -DOGRE_BUILD_RENDERSYSTEM_GLES=FALSE -DOGRE_BUILD_TESTS=FALSE -DOGRE_BUILD_TOOLS=FALSE
- if all gone well, ogre will be configured for compile. Now execute in the command prompt:
Code: Select all
nmake
Now i'm getting stuck in the ant step, because nmake says that SampleBrowserDummy was compiled, but it's liying because "android" post build step is failing.
It seems that android update doesn't create the build.xml file to feed ant.
I've copied my ant files from another project to "build/SampleBrowserNDK/", and now is currently compiling the project.
-
- Gnoblar
- Posts: 8
- Joined: Wed May 23, 2012 6:09 am
Re: Improving Android support
Hi Brocan ,
Thanks a lot .I will have a try right now.Thanks for your help.
Thanks a lot .I will have a try right now.Thanks for your help.
- Brocan
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
Re: Improving Android support
Ok, compiled and installed in Samsung Galaxy S2, thanks for your efforts wolfmanfx!
The sample browser starts without problems, but i've found some crashes:
- When the orientation changes, the app goes black and doesn't respond.
- When the context menu button is pressed in the mobile, the app freezes.
The input is not correctly translated in the mouse. In landscape, if i put my finger in the bottom right corner, the mouse is moved a few from center, so i cannot start any demo because i can press the start button
Edit: ok, the input problem is solved, i've see that in file "SampleBrowser_Android.h" the resolution for the window is hard coded to 1280x800, i've changed to 800,480 and now it works. This data must be queried from some place.
Tested sinbad and a bunch of examples more, all working, but the back button in the phone doesn't work and crashes the app.
The sample browser starts without problems, but i've found some crashes:
- When the orientation changes, the app goes black and doesn't respond.
- When the context menu button is pressed in the mobile, the app freezes.
The input is not correctly translated in the mouse. In landscape, if i put my finger in the bottom right corner, the mouse is moved a few from center, so i cannot start any demo because i can press the start button
Edit: ok, the input problem is solved, i've see that in file "SampleBrowser_Android.h" the resolution for the window is hard coded to 1280x800, i've changed to 800,480 and now it works. This data must be queried from some place.
Tested sinbad and a bunch of examples more, all working, but the back button in the phone doesn't work and crashes the app.
- Wolfmanfx
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
- Contact:
Re: Improving Android support
Nice that it worked - i already fixed the res. issuse.
The crashes are excepted atm - like i mentioned android gles20 destroys the context on orientatiion changed and on home button - we have to recreate the resources on the gpu again - thats a big feature which needs carefully planning.
The crashes are excepted atm - like i mentioned android gles20 destroys the context on orientatiion changed and on home button - we have to recreate the resources on the gpu again - thats a big feature which needs carefully planning.
- SomeFusion
- Gremlin
- Posts: 191
- Joined: Sun Dec 01, 2002 12:38 am
- x 3
Re: Improving Android support
Great work!
*Edit* Uploaded a screenshot from the Prime
http://dl.dropbox.com/u/3473245/prime_screenshot.jpg
I've got it compiled and installed on my Galaxy Nexus and my Transformer Prime.
It runs on the prime but crashes on my Nexus. I've pasted the logcat information to pastebin: http://pastebin.com/F5BnxXgk
*Edit* Uploaded a screenshot from the Prime
http://dl.dropbox.com/u/3473245/prime_screenshot.jpg
I've got it compiled and installed on my Galaxy Nexus and my Transformer Prime.
It runs on the prime but crashes on my Nexus. I've pasted the logcat information to pastebin: http://pastebin.com/F5BnxXgk
Summoning Wars is an open source role-playing game, featuring both a single-player and a multiplayer mode for about 2 to 8 players.
http://www.sumwars.org
http://www.sumwars.org
-
- Gnoblar
- Posts: 3
- Joined: Sun May 27, 2012 6:49 pm
Re: Improving Android support
Great job! Thanks for your efforts
I compiled on Ubuntu and had to modify upper and lower case characters in some folders and file names.
After that, all the demos are working in a Galaxy Tab 10.1v. However, I always see the mouse pointer slightly above the point I touch. In addition, as far as I move my finger on top of a button (by dragging, not clicking), a click is automatically done.
I compiled on Ubuntu and had to modify upper and lower case characters in some folders and file names.
After that, all the demos are working in a Galaxy Tab 10.1v. However, I always see the mouse pointer slightly above the point I touch. In addition, as far as I move my finger on top of a button (by dragging, not clicking), a click is automatically done.
-
- Gnoblar
- Posts: 8
- Joined: Wed May 23, 2012 6:09 am
Re: Improving Android support
Is anyone compile on eclipse successfully ? I still hadn't worked it out.
- Brocan
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
Re: Improving Android support
Are you triying to compile the whole ogre project within eclipse?Liu Xinya wrote:Is anyone compile on eclipse successfully ? I still hadn't worked it out.
Maybe you should try to compile ogre lib following my steps and after that create a single jni project using eclipse (or what you want) and use the library
- Wolfmanfx
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
- Contact:
Re: Improving Android support
I fixed the touch input and added support for the back button to pause/resume samples also the display resolution is automatically set (only tested on my acer)
- Brocan
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
Re: Improving Android support
Great work! I'll try tomorrowWolfmanfx wrote:I fixed the touch input and added support for the back button to pause/resume samples also the display resolution is automatically set (only tested on my acer)
- Brocan
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
Re: Improving Android support
I've made a small modification in CMakeLists from SampleBrowser.
As ANDROID_NDK is defined by the toolchain, this avoids the needed of having ndk-build in your environment path.
Also "android" tool could be readed from ANDROID_SDK env var.
Ok, tested and working in S2. The touch input is strange right now, when you do a single touch the click is done where the cursor is, not where your finger is... and this is disturbing
Resolutions and back button seem to work well, context button doesn't make a crash also, great.
I've added also to Android manifest the following lines to hide notification bar, and for lock the orientation until the orientation change issue is fixed.
Great work as always, and thanks for your efforts!
As ANDROID_NDK is defined by the toolchain, this avoids the needed of having ndk-build in your environment path.
Code: Select all
SET(NDK_BUILD_EXECUTABLE "${ANDROID_NDK}/ndk-build")
Ok, tested and working in S2. The touch input is strange right now, when you do a single touch the click is done where the cursor is, not where your finger is... and this is disturbing
Resolutions and back button seem to work well, context button doesn't make a crash also, great.
I've added also to Android manifest the following lines to hide notification bar, and for lock the orientation until the orientation change issue is fixed.
Code: Select all
<activity android:name="android.app.NativeActivity"
android:label="OgreSampleBrowser"
android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="landscape" >
-
- Gnoblar
- Posts: 8
- Joined: Wed May 23, 2012 6:09 am
Re: Improving Android support
Brocan wrote:I've made a small modification in CMakeLists from SampleBrowser.
As ANDROID_NDK is defined by the toolchain, this avoids the needed of having ndk-build in your environment path.
Also "android" tool could be readed from ANDROID_SDK env var.Code: Select all
SET(NDK_BUILD_EXECUTABLE "${ANDROID_NDK}/ndk-build")
Ok, tested and working in S2. The touch input is strange right now, when you do a single touch the click is done where the cursor is, not where your finger is... and this is disturbing
Resolutions and back button seem to work well, context button doesn't make a crash also, great.
I've added also to Android manifest the following lines to hide notification bar, and for lock the orientation until the orientation change issue is fixed.
Great work as always, and thanks for your efforts!Code: Select all
<activity android:name="android.app.NativeActivity" android:label="OgreSampleBrowser" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:screenOrientation="landscape" >
Hi Brocan,
I hadn't done it.I followed you step by step operation,but it did not succeed.Besides,it told me these mistakes,as follow:
-- Configuring OGRE 1.8.0unstable
-- Check if the system is big endian
-- Searching 16 bit integer
CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/TestBigEndian.
cmake:44 (MESSAGE):
no suitable type found
Call Stack (most recent call first):
CMakeLists.txt:161(test_big_endian)
-- Configuring incomplete,errors occurred!
I modified some env var,and some others's configure, It is still no response.
Are you using the Windows System? And ,use the Linux or others ? I just followed your steps ,on Windows System ,configured some env vars,putted the "AndroidDependencies" and the "wolfmanfx-ogre" in the same folder. And in the vs2008 nmake command line the executed this command:
cmake .. -G "NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE="../CMake/toolchain/android.toolchain.cmake" -DOGRE_DEPENDENCIES_DIR="../AndroidDependencies" -DTargetPlatform="Android" -DOGRE_BUILD_RENDERSYSTEM_GLES2=TRUE -DOGRE_STATIC=TRUE -DANDROID_NATIVE_API_LEVEL=14 -DOGRE_BUILD_COMPONENT_PAGING=FALSE -DOGRE_BUILD_COMPONENT_TERRAIN=FALSE -DOGRE_BUILD_COMPONENT_RTSHADERSYSTEM=TRUE -DOGRE_BUILD_PLUGIN_BSP=FALSE -DOGRE_BUILD_PLUGIN_PCZ=FALSE -DOGRE_BUILD_RENDERSYSTEM_GLES=FALSE -DOGRE_BUILD_TESTS=FALSE -DOGRE_BUILD_TOOLS=FALSE
But the result is very disappointing.
- Brocan
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
Re: Improving Android support
Which cmake version are you using? visual studio 2008 express or pro? could you put the whole cmake trace? and the contents of the files "build/CMakeFiles/CMakeOutput and CMakeErrors?
-
- Gnoblar
- Posts: 3
- Joined: Sun May 27, 2012 6:49 pm
Re: Improving Android support
Thanks Wolfman!
I've tried your latest modifications in my Galaxy Tab 10.1, and confirm that the mouse offset problem with respect to the touched point is fixed. However, I was still getting some strange behavior on click as also reported by Brocan.
I have slightly modified the injectMouseDown event in the SdkTrays.h file under Samples/Common/include, and now works fine for me. Find below the diff output. The new code just updates the position of the cursor in the injectMouseDown event, and not only in the injectMouseMove.
With this little change it is working great! Thanks!
I've tried your latest modifications in my Galaxy Tab 10.1, and confirm that the mouse offset problem with respect to the touched point is fixed. However, I was still getting some strange behavior on click as also reported by Brocan.
I have slightly modified the injectMouseDown event in the SdkTrays.h file under Samples/Common/include, and now works fine for me. Find below the diff output. The new code just updates the position of the cursor in the injectMouseDown event, and not only in the injectMouseMove.
Code: Select all
--- a/Samples/Common/include/SdkTrays.h Tue May 29 11:12:21 2012 +0200
+++ b/Samples/Common/include/SdkTrays.h Tue May 29 18:31:06 2012 +0200
@@ -2911,11 +2911,13 @@
#if (OGRE_PLATFORM != OGRE_PLATFORM_APPLE_IOS) && (OGRE_PLATFORM != OGRE_PLATFORM_ANDROID)
// only process left button when stuff is visible
if (!mCursorLayer->isVisible() || id != OIS::MB_Left) return false;
+ Ogre::Vector2 cursorPos(mCursor->getLeft(), mCursor->getTop());
#else
// only process touches when stuff is visible
if (!mCursorLayer->isVisible()) return false;
+ Ogre::Vector2 cursorPos(evt.state.X.abs, evt.state.Y.abs);
+ mCursor->setPosition(cursorPos.x, cursorPos.y);
#endif
- Ogre::Vector2 cursorPos(mCursor->getLeft(), mCursor->getTop());
-
- Gnoblar
- Posts: 8
- Joined: Wed May 23, 2012 6:09 am
Re: Improving Android support
Hi Brocan,Brocan wrote:Which cmake version are you using? visual studio 2008 express or pro? could you put the whole cmake trace? and the contents of the files "build/CMakeFiles/CMakeOutput and CMakeErrors?
My cmake version is 2.8.1,vs 2008TeamSuite90DayTrialCHSX1429243.iso.I don't have a CMakeErrors file,but the CmakeOutput file tells me that:there's not mistakes.
By Using CMake-GUI:the source code points to the path "D:/Android_Ogre/OgreAndroidSrc" ,the build the binaries points to the path "D:/Android_Ogre/OgreAndroidSrc/build".
I put the Required dependencies,Recommended dependencies in the fodler of Dependencies.In the Cmake-gui ,by pressing configure button (Specify the generator for this project is Visual Studio 9 2008),it make mistakes.
Errors as follow:
Cmake Error at CMake/Utils/MacroLogFeature.cmake:100(Message):
-------------------------------------------------------------------------------------------------
-- The following REQUIRED packages could NOT be located on your system.
-- Please install them before continuing this software installation.
-- If you are in Windows,try passing -DOGRE_DEPENDENCIES_DIR=<path to dependencies>
---------------------------------------------------------------------------------------------------
+ freetype:Portable font engine <http://www.freetype.org>
---------------------------------------------------------------------------------------------------
Call Stack(most recent call first):
CMake/Dependencies.cmake:235(MACRO_DISPLAY_FEATURE_LOG)
CMakeLists.txt:179 (include)
Since this,I put the freetype-2.4.9 in the Dependencies folder,but it makes no respnse.