Oculus Support - Desktop Platform

Monkey Targets Forums/Desktop/Oculus Support - Desktop Platform

FBEpyon(Posted 2015) [#1]
Hello,

I recently in the last few days got a Oculus Rift SDK2, and with it I picked up the SDK for it, and all the CPP, and Headers files.

I was wanting to know because there are not any direct access to pointers in Monkey that I wouldn't have an easy time adding the needed files to it so that I can start adding support for VR, and what not using MiniB3D.

What options would I have to add in the supported files from the SDK to get it to work.

Thanks,


nullterm(Posted 2015) [#2]
I wouldn't have your .monkey code talk directly to the Oculus stuff.

You'd probably be better off writing up a wrapper class/module that your game talks to, and keep all the Oculus specific code/objects/pointers in your native C++ extension code. Then add functions/methods for EyeX/Y/Z for rendering from different eye positions.

From looking at the Oculus SDK developer guide, you might need to also re-work some of the GLFW desktop target code, like to use their eye distortion to get the fisheye lense effect.

Maybe even change it so you do two OnRender calls to your app (one left, one right) per OnUpdate when running in Oculus mode.

Then you can either use MiniB3D and/or your own monkey GL code to render the scene.


skid(Posted 2015) [#3]
I wrapped the oculus SDK in a Monkey target quite a while back and exposed a simple CreateCube command while running the tiny demo "side on". My plan was to implement the camera and navigation in native by butchering the tiny demo and use monkey code to manipulate the scene's contents.

To keep things simple I elected to use int for the monkey side and dereference to pointer on the native side using std::map<int,cube*>.

However, in the end I decided that C++ was a better environment to learn about VR so switched back to visual studio as using monkey doesn't really make sense if there is a bunch of other unknowns in the project.


FBEpyon(Posted 2015) [#4]
Thanks for the quick replay..

You'd probably be better off writing up a wrapper class/module that your game talks to, and keep all the Oculus specific code/objects/pointers in your native C++ extension code. Then add functions/methods for EyeX/Y/Z for rendering from different eye positions.


That is were the problem is; that when righting the wrapper you don't have direct access to creating pointers other than maybe creating code in C++ again that creates the new classes that monkey uses from another external file.

I notice in most of the things people have done to get access to pointers is by doing new C++ files that handle all the pointing, and then assign this to a new variable in the class that Monkey uses to assign the required information back to the SDK.

Let me know if that make any sense...

skid...

Can you provide me with the code that you used to do this so I have some sort of frame to work off of? I think adding Oculus Support to monkey would help promote it more.

Thanks,


nullterm(Posted 2015) [#5]
"I notice in most of the things people have done to get access to pointers is by doing new C++ files that handle all the pointing, and then assign this to a new variable in the class that Monkey uses to assign the required information back to the SDK."

You nailed it right there.

You need a wrapper ( see this article: http://en.wikipedia.org/wiki/Wrapper_library ). It talks directly to the Oculus SDK, initializes, manages, updates, gets data back, etc. And also exposes the bits that your monkey codes needs. You probably don't need to expose everything to your monkey code, just in the C++ native part.

Examples...
Eye position/orientation you will probably need for rendering.
But your game .monkey code probably doesn't need to know about the lens distortion, if it's contained in the target/extension C++ code.

I am super curious about DK2 myself, would love to play with it either through C++ or Monkey. But no hardware yet.


FBEpyon(Posted 2015) [#6]
Thanks,

I just got mine, and a Leap Motion.

I was looking at all the release stuff for Unity, but for some reason I keep getting drawn back to either Monkey or Max. So I was looking at trying to add support for it, or see if there was any current support for it.

I will have to play around with it for a bit and see if I can even figure out the wrapping.

Thanks A Lot!!