This is a heads-up for the core-team regarding support for Google Cardboard. The reason is some changes to core has been necessary to accomodate for this. I hope to be able to publish a repo and make a pull request this weekend.
Here’s the explanation:
A cardboard application should extend CardboardApplication to get access to the convenience methods and functions that their API supplies. Since a jMonkeyEngine android application extends AndroidHarness I’ve created a corresponding CardboardHarness that extends CardboardApplication.
So far so good.
It also expects there to be a CardboardView.Renderer implemented. To do this I extended OGLESContext and implemented it there in a class called CardboardContext.
Finally, to instantiate this, I extended JmeAndroidSystem in JmeAndroidCardboardSystem which returns the CardboardContext in newContext.
So far no changes to core, these all fit in a small jar on their own.
However, as you might realize, something needs to check for this JmeAndroidCardboardSystem. So, I had to add a check in JmeSystem :
systemDelegate = tryLoadDelegate(“com.jme3.system.android.JmeAndroidCardboardSystem”);
before it looks for JmeAndroidSystem. I couldn’t find any other way of injecting the context (although I’ve tried a few). I’ll be happy to refactor if anyone has any idea how to achieve this without modifying core. The good thing is it has no other dependencies than this.