I am currently planning to implement a little painting app using OpenGL ES 1.1. I believe this question applies to any OpenGL ES project. I am starting development on Android and I would like to know if you would recommend writing the drawing logic (using OpenGL) in C++ with the NDK so it will easier to port to iOS, or to use the Java API and being locked on Android.

The reason I am asking that is because I have seen mixed opinions on the Web about using the NDK (some people say it is an added level of complexity). From what I have already seen, I believe that I should go with the Java API since I am starting on Android and then, if I decide to go on iOS, to rewrite the OpenGL logic in Objective-C or C++. This should be pretty straightforward since the calls appear to be the same in both languages. What do you think? Am I right?

1 Answer 1


Yes, NDK will add a layer of complexity. But it will probably be worth it.

If your drawing is done in c++, then you better implement your model in C++ too. That gives you less code to rewrite for iOS and less code to maintain.

Luckily (in this case) OpenGL is state machine, so it is fairly simple to set up the rendering context in java (being close to the GUI code) and then pass control to C++ for the actual OpenGL drawing calls.

Implementing an NDK (JNI) interface is quite repetitive. It might feel ugly to set up your first three classes or so. After that you'll get the hang of it and it is just interface desig and typing code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.