EDIT: Using Oculus Rift on MAC OS X video post can be found here. This post is a failed experiment on Getting started in Xcode with the SDK. Yloly has left some useful tips to help me in the comments section of this post. If anyone else has any pointers please feel free to leave them.
I haven’t actually received my Oculus Rift yet, but that doesn’t stop me doing wanting to develop for it. There seem to be quite a few ways you can develop things for it, the easiest seem to be by using game engines such as Unity or Unreal. I however for a work project we want to do some things with the Oculus Rift with the Personal Corpus and therefore I want to get to grips with doing stuff in C++. I thought I’d make some notes as I went along.
If your on Mac OS X then you should be able to get your hands on Xcode to do some stuff with the rift. As far as I’m aware Xcode is free and available from the app store. It’s appeared on my machine somehow anyway.
OK, first things first: I’m not a very good programmer, more of a web developer who understands OO but can’t implement it very well. Secondly I am new to Xcode, I’d like to use Visual Studio but I have access to OS X more than Win 7, when I develop stuff on my Mac I usually use Eclipse as an IDE because it appears to be able to do everything; but I am assured that Xcode is the way to go for C++. I’m using the windows minimal app on the development wiki as a guide.
Step one: Download Xcode
Go to the Mac App Store, install Xcode
Step two: Start a C++ project.
When Xcode Starts there should be an option to start a new project. Once you’ve pressed that then look for the option to start a Command Line Tool under OSX->Application.
You’ll need to pick a product name, organization name and indentured. I needed to pick a product name but it had already filled its self with examples for the others that would do for my hello world app. I guess for test purposes this doesn’t matter too much. I did however have to change the Type to C++.
Step three: check everything is in order
Under your project directory you should see a main.cpp. This is a prebuilt helloworld c++ program. You can click the run button to see what it does (which is push “hello world to the output program at the bottom of the scree).
Step four: include Oculus Rift SDK
This is where my lack of Xcode/C++ experience will really shine. You need to download the Mac SDK from the Oculus Rift developers site and include the LibOVR directory in you project. I right clicked my project and went to ‘add files’ I then navigated to the LibOVR directory and clicked ok.
Now back in your main.cpp add the line:
under #include <iostream> and
using namespace OVR;
Under that I created some global variables; These were recommended by the Oculus Rift Wiki:
Ptr<DeviceManager> pManager; Ptr<HMDDevice> pHMD; Ptr<SensorDevice> pSensor; SensorFusion FusionResult; HMDInfo
At this point you should be able to copile but I got this error:
expected predicate and/or actions following probe description,
but I guess this is because I don’t have a Rift connected. I guess my code will have to sit there until the postman knocks. 🙁
EDIT: I tried this with a Oculus Rift plugged in and it still didn’t work. Would be glad if anybody could help me out.