Android build behavior on Galaxy Nexus, and S4

Problems building or running the engine, queries about how to use features etc.
Post Reply
ogreogre
Halfling
Posts: 59
Joined: Mon Aug 13, 2007 8:30 pm

Android build behavior on Galaxy Nexus, and S4

Post by ogreogre »

Hi, I have built ogre 1.9 branch from source on Android. The build went OK. I have two devices: Galaxy Nexus running 4.1.1, and Galaxy S4 running 4.3. I have tried OgreJNI and SampleBrowserNDK on the both device, and here's what I got:

On Galaxy Nexus: OgreJNI shows just red blank screen; sample browser runs well, but in Configure, the RenderSystem is shown to be "OpenGL ES"--shouldn't it be "OpenGL ES2"?

On Galaxy S4: OgreJNI shows the same red blank screen; sample browser shows a black screen for a long time (the OS intervened and asked if I wanted to wait for stop it), but in the end the gui showed up and the samples ran well. Configure shows the same "OpenGL ES" as Render System.

So my questions are: is the above what people see for 1.9 Android build? Should I be getting the red blank screen? Should the Render System be "OpenGL ES"? The long delay at startup, on the S4, is hard to understand, because you'd think if anything it'd be (much) faster.

I just want to make sure I'm getting the "state of the art" results from the build.

Thanks,
Steve
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Android build behavior on Galaxy Nexus, and S4

Post by c6burns »

Sounds like a completely normal build. The JNI sample literally has nothing in it. It just sets the background of the viewport to red ... no RTSS, no resource loading. It does load plugins though :)

The samplebrowser parses a LOT of script files which is why it takes so long to get started. If you make your own native activity or jni project, you will not have any problems in that regard because you will have your own resource groups that you load at various times ... instead of loading everything for all the samples at once. I don't think it's a matter of how awesome or not awesome your device is ... it's doing a lot of work without handling lifecycle events. Also the way lifecycle stuff works is if you touch the screen (for example), the system will notice your app not responding sooner than if you don't.

Right now I have a JNI project, and it loads a single resource group with only what I need for my splash screen in under 1 second.
ogreogre
Halfling
Posts: 59
Joined: Mon Aug 13, 2007 8:30 pm

Re: Android build behavior on Galaxy Nexus, and S4

Post by ogreogre »

thanks for the info c6. sigh of relief! BTW, there doesn't appear a "mid size" demo for Ogre/Android, i.e. something between OgreJNI and the giant SampleBrowser. Do you have any pointers? Thanks, Steve
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Android build behavior on Galaxy Nexus, and S4

Post by c6burns »

Nothing really mid-sized. There's a way more streamlined (compared to the samplebrowser) GLES2 native app in the binary android SDK, which initializes RTSS and drops the sinbad model into the scene. http://www.ogre3d.org/download/sdk

I pulled some code out of there and the sample browser when I was first building up my JNI project.
ogreogre
Halfling
Posts: 59
Joined: Mon Aug 13, 2007 8:30 pm

Re: Android build behavior on Galaxy Nexus, and S4

Post by ogreogre »

The thing is I tried the Android SDK first, but it didn't work--the OgreGLES2Sample demo from the SDK (I still have it installed on the S4) gave me a red background and nothing else.

Hmm I should try to compile it again the libs I built myself, and see if it works....
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Android build behavior on Galaxy Nexus, and S4

Post by c6burns »

Hmmm yeah the GLES2 sample from the SDK should be red background, but with sinbad the ogre in the center. I never tried building from the binary SDK, I just pulled the RTSS initialization code out and jammed it into my JNI project. I don't have an S4 but I do have a galaxy nexus so if you have an issue with building an app based on v1-9 head I should be able to reproduce.
ogreogre
Halfling
Posts: 59
Joined: Mon Aug 13, 2007 8:30 pm

Re: Android build behavior on Galaxy Nexus, and S4

Post by ogreogre »

For the record: the issue with the Android SDK GLES2 sample, on the S4, is the following. This is compiled with the Ogre binary that came with the SDK. I'm about to try to compile it with Android binaries I built myself.

02-07 12:15:34.917: I/OGRE(16705): GLSL ES compile log: RTSS_11_VS
02-07 12:15:34.917: I/OGRE(16705): OpenGL ES #version <number> is not supported
02-07 12:15:34.917: I/OGRE(16705): ERROR: 0:2: '' : GLSL compile error: #version is followed by spurious tokens
[/color][/color][/color]02-07 12:15:34.917: I/OGRE(16705): ERROR: 1 compilation errors. No code generated.
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Android build behavior on Galaxy Nexus, and S4

Post by c6burns »

OK that's a weird error from compiling an RTSS shader. It definitely explains why the scene is blank. I don't have an S4 but I think it's the same GPU as the Nexus 4 (Adreno 320). I don't think you'll have that issue when you're done building v1-9 head.

EDIT: OK I just learned there's at least 3 different hardware configs for the S4 and not all are adreno 320s
ogreogre
Halfling
Posts: 59
Joined: Mon Aug 13, 2007 8:30 pm

Re: Android build behavior on Galaxy Nexus, and S4

Post by ogreogre »

Indeed. After I compiled the GLES2 android SDK example with my own libs (basically, after changing a bunch of -I and -L in android.mk), the example runs fine on the S4! -- It's red background with a static full-body ogre :)

BTW, c6, since you are going with full JNI... What are you GUI options? The GUI use by SampleBrowser works but is pretty strange with its own cursor (very old fashioned?) Actually, the samplebrowser GUI works better on Android than on iOS, because on iOS you must operate the SampleBrowser GUI's own cursor very laboriously...
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Android build behavior on Galaxy Nexus, and S4

Post by c6burns »

Right now I actually just use my own simple UI with overlays. I implemented some very simple transition motions for panels. I'll probably replace it with gorilla when I get a chance. I don't want an overly complex UI getting in my way, and gorilla looks very simple and easy to use. I really don't use anything in java at all ... I mainly chose JNI because at the time I had to choose between native activity and JNI, the OUYA did not have any way of supporting the default controller in a native activity. Plus I'm in a position to integrate anything I might want that's java-only, while a native activity doesn't provide any real benefit in terms of performance (it's actually just one big jni anyway).

I don't use a cursor for anything. My game is completely accelerometer based during levels and touch/UI based in between. I haven't extended it to work in iOS yet ... I just got my mac mini and ipad so I'll probably end up doing that next month.
ogreogre
Halfling
Posts: 59
Joined: Mon Aug 13, 2007 8:30 pm

Re: Android build behavior on Galaxy Nexus, and S4

Post by ogreogre »

Thanks for the thoughts c6. I googled around for GUI options in the last few days. It seems like people (on this forum) have been able to make ogre work with cocos2d-x on iOS and Android. (The former more conclusively than the latter, from what I read--I could be wrong.) So that's something I'll look at. Have you heard of other attempts at the cocos2d-x + Ogre combination?
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Android build behavior on Galaxy Nexus, and S4

Post by c6burns »

Sounds like overkill to me, but that's just this particular beholder's eye. I'd want something that does very simple work with Ogre's overlay component and freetype textures, and helps batch my UI to reduce draw calls. I already have fairly impressive results with just using overlays and freetype directly but it doesn't do any batching. Plus at this point I have 6 platforms to maintain so I am reticent to introduce new dependencies unless they are a) hot stuff, b) really small, or c) already build flawlessly on all my platforms with cmake

I see a lot of people choosing CEGUI and MyGUI, but they seem bloated to me as well. I've heard good things about libRocket, but again I question if I actually need to add that dependency. Gorilla is really the only one I'm considering at this point: http://www.ogre3d.org/forums/viewtopic.php?f=11&t=59984
ilotuo
Gnoblar
Posts: 16
Joined: Wed Nov 04, 2015 7:55 am

Re: Android build behavior on Galaxy Nexus, and S4

Post by ilotuo »

ogreogre wrote:Indeed. After I compiled the GLES2 android SDK example with my own libs (basically, after changing a bunch of -I and -L in android.mk), the example runs fine on the S4! -- It's red background with a static full-body ogre :)

BTW, c6, since you are going with full JNI... What are you GUI options? The GUI use by SampleBrowser works but is pretty strange with its own cursor (very old fashioned?) Actually, the samplebrowser GUI works better on Android than on iOS, because on iOS you must operate the SampleBrowser GUI's own cursor very laboriously...
Can you share your lib?
ilotuo
Gnoblar
Posts: 16
Joined: Wed Nov 04, 2015 7:55 am

Re: Android build behavior on Galaxy Nexus, and S4

Post by ilotuo »

Hi .
Can you offer your prebuilt libs?
Or give what version of ogre/ndk you used? Can I only compiled the render system ?
I really need in this moment!
Thank you very much!
Post Reply