Cinder inside native Android and iOS views

I’ve started working on some interactive graphics in a cross platform mobile app (iOS and Android) and have so far just been using raw OpenGL ES but naturally miss the Cinder tools a lot.

It occurred to me that I might be able to link the Cinder library in for this thanks to the recent developments in Cinder for android.

The apps are being developed in parallel for both platforms to take advantage of their respective native UI etc and the OpenGL stuff is almost entirely contained within one view within the app.

I saw the iosNativeControls sample which shows that this use case should be fairly easy to get working in the iOS version. My question is whether we have an equivalent way to create a Cinder app view inside a native android app? (ie nestled in with native components and views).

Any advice on how painful this is likely to be or precedents would be greatly appreciated. I have no previous experience in android but other engineers in the team do. It would be awesome to have access to cinder in this project but appreciate it might still be early days.

Thanks!

It would be fantastic to have an “androidNativeControls” sample in the future to sit alongside the ios one. I’m just not sure how much of a pipe dream this is at the moment…

Definitely worth working towards though.

I haven’t looked into this that much, so I don’t know how much insight this’ll be but I did some cursory exploration into this not too long ago(I gave up cause my idea at the time was dumb :stuck_out_tongue:) and I imagine it’s possible to build something like the iosNativeControls example.

A Cinder Android app lies inside of a NativeActivity(technically CinderNativeActivity but that’s subclassing NativeActivity) which a subclass of an Activity, I think the IOS equivalent to an Activity might be an AppDelegate. Last I recall it’s possible to nest Activities within one another so you could conceivably nest a Cinder instance within the activity of a larger main Android app, though that’s not something I’ve tried. I know it’s definitely possible to overlay Activities on top of each other, so that may be another path to explore.

The painful part, which is what I was focusing on learning about during my exploration, is communication between the main Android app and the Cinder instance. There are some wrappers for certain things built into the NDK, but in all likelyhood, you will probably have to write some custom wrappers between the Java and C++ to fully integrate with what you’re building. It’s not hard, but it’s a lot of code.

The NDK has some examples, this one if I remember correctly was the one I was using as a guide to figure out C++ / Java communication.

Look at Engine::ShowUI() - it should be calling the “showUI” function in the Java file here

There was someone on here that ported their app to Android from IOS, I can’t remember the username at the moment though :confused: