How feasible is using the NDK?

Started by
14 comments, last by JoeJ 11 years, 1 month ago

Awesome, that's great to hear, thanks Buster! I'll take a look at some of those resources. Though I'm a foolish person, and am going to roll my own tech.

Perception is when one imagination clashes with another
Advertisement

Using NDK is a must for me, as it allows to share 99,9% of code with IOS, and i can develop my game with Visual Studio 99,9 % of the time :)

Using native activity is only available on updated devices, so i avoid it and use java for those things:

* Loading files (c file functions work, but can't access the comprerssed package contents so easy)

* Sound (OpenAL is available but relatively new to Android)

* Threading (never tried pthreads, but they would be available on IOS too!)

* Creationg OGL context

* reading sensors

* (Network, server communiction... if you need)

Expect a little bit of pain getting all this basic things to work, but then it shouldn't be a problem

to run any OGL engine with a few #ifdefs, no matter how complex it is

NDK itself is just C++ as you know it - Nvidia has some nice Installers that setup all you need (Cygwin...)

JoeJ, that sounds amazing. I'm a console developer at work, and I'd really like to be able to still work in Visual Studios without too much hassle. And I have experience with pthread, so I should be able to cross that one off the list.

I hope I can create my OGL context in my code, but if I can't, it's not the end of the world.

I'll have to check out the Nvidia resources and see what they can do for me.

Perception is when one imagination clashes with another

I'm currently using the NDK with SDL2 (ex. 1.3) and it's been a piece of cake. Sure, the debuging options are limited, but so long as you setup some defines for logging (so you can use the logcat) and learn how to use gdb it's not too bad. It helps if you can help your project for a different platform (e.g. Linux or Windows) and debug on there, but this may not be possible depending on what you are doing.

I'm sharing code between Windows, OSX, Linux and Android (all non-NEON devices, as SDL doesn't build correctly for them) at the moment, using CMake to build all of the projects except the Android one - where I use the NDK tools on Linux, but I've tested Cygwin and that works too. Eventually I'll add iOS in the mix, but I thought I'd leave that for a while (this is probably a massive mistake) as I wanted to get on and actually start developing.

At some point I'll clear out all the project specific code and upload a blank project template to bitbucket or github, since it's taken a little bit of work to get it all working, but now it is all setup it's a doddle.

That's great to hear. I've never played around with make files so this should be quite the learning experience, but I'm glad to hear such positive feedback. Another question. I've got a working OpenGL 2.0-3.3 graphics engine, how hard is it to port to Android/iOS. (I know you don't know the code, but just in general)

Perception is when one imagination clashes with another

I don't know exactly, cause i work with OGL 1.x, which is similar to ES 1.0.

But i'm pretty sure that 2.0-3.3 is very similar to ES 2.0.

The deprecated stuff (glBegin, glRotate...) is missing from ES 2.0, and ES supports only triangles, no quads.

Which means that most probably you don't need to change anything from the runtime stuff.

Performance is another question - i target 60 fps and for me fillrate is the only thing that seriously affects performance.

OGL calls do not return immideatly, so it's good to have another thread doing the next timestep

while the render thread waits on gpu even on single cores.

I think the real mess with mobiles is understanding the thing called activity lifecycle on android:

What happens on incoming calls... When do you need to reload textures, because android killed OGL context...

What does my app in background... Which things are restored automatically when it comes back...

Problem is that i'm never sure if what i do is right for all devices.

@MODERATORS: I CAN'T LOGIN FROM FIREFOX (19.0) - IE IS OK

This topic is closed to new replies.

Advertisement