DanielP
DanielP

Reputation: 1

Head-tracking in Android NDK app

I have an Android app which displays rendered content over OpenGL ES. This is NOT over Unity or any other engine. It is a custom engine with all the relevant code parts in the NDK.

Now I want to make this to work for Virtual Reality devices like Google Cardboard and similar ones, where the mobile phone is put into a case with lenses.

How can I get the head orientation from the smartphone sensors inside the NDK? Probably the gyro and accelerometer values are required for this? How to get those inside the NDK and how to convert this into the required head orientation?

Thanks!

PS: Currently using android-ndk-r10e, adt-bundle-windows-x86_64-20140702, jdk1.8.0_45, target is Android-19.

Upvotes: 0

Views: 995

Answers (2)

DanielP
DanielP

Reputation: 1

What I have found in terms of Java libs for head-tracking under Android are the following. But they don't come with the JNI calls for usage in the NDK, these would need to be added manually. If someone has sample code or instructions to do this, please add to this thread.

Upvotes: 0

brainsandwich
brainsandwich

Reputation: 492

Yes the sensors are required. There should be libraries around that already do this but notthat I'm aware of. The values you want to get are from Android API, which is accessible mainly (read : "only") through JNI calls (call java from C/C++). Then the things you want to get seem to be listed here.

Upvotes: 0

Related Questions