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

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:

#include “OVR.h”

under #include <iostream> and

using namespace OVR;

beneath that

Screen Shot 2013-09-09 at 12.17.01

 

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.

Categories: Technology

8 Comments

yloly · October 13, 2013 at 1:44 am

I am not a C++ expert. But here is what I did to make it to work (After banging my head for an afternoon).

You don’t need the “LibOVR_With_Samples.build” folder. Delete it and this will solve the error you had in your post. Then follow the error msgs and delete the files for Window and Linux. Then link Carbon and IOKit framework.

Hope this will help ~~ 😀

    David Sherlock · October 13, 2013 at 10:27 am

    Yloly, you are a legend. I’ll have a go at this asap and let you know how I get on. I have tried this a few times with little success, my guess is I forgot to link the frame works. Not being a C++ developer I’ve ended up using rift bridge and tree.js instead.

    Thanks for the pointers

Neil Galang · December 13, 2013 at 8:09 pm

Hello! I hope there are more posts like this because I come from a similar background with the same setup . How is your development coming along?

    David Sherlock · December 13, 2013 at 9:22 pm

    Hi! I have moved away from the C++ library. I think this is really for people who are creating tool sets; plus the SDK is likely to change while it is an early version. Instead I am looking in to making stuff using a JavaScript library called three.js. It. means you can make stuff and put it on the web. I am going to do a tutorial over the Christmas holiday but until then you can get an idea of what I am doing here: http://davidsherlock.co.uk/set-web-based-oculus-rift-world/

    Have you tried developing anything yet?

Neil Galang · December 15, 2013 at 12:20 am

hello again — My rift will arrive in a week and I am still preparing my Mac. (Games + Drivers and all!) Where do you recommend I start? What are the games that I shouldn’t miss out on as well as the development software I could use. I am interested in the three.js platform you’re using!

    David Sherlock · December 15, 2013 at 1:05 am

    Hi again!

    I’m a bit out of the loop as I haven’t worked on my Rift stuff for a few weeks, I’m thinking of doing a series of posts on where to start for people on Macs/on a budget. It depends on what sort experience you have and what you want to achieve. Unity has lots of assets you can borrow to try things out, I did a how to use assets to make a unity game in ten minutes video: http://www.youtube.com/watch?v=7kuQYcIYPvQ . Unfortunately Unity is only free for 3 months and then you have to pay (you should get a free 3 month trial with your rift).

    If you are a web developer three.js is good because it’s free and it uses open standards. If you look for the “Oculus Bridge” github and download the zip file there are some three.js examples in there. I guess the draw back are that you need to be able to visualise what your code looks like, which I am not very good at! Also the browser based things can’t be as complex as things you can do in Unity that compile natively.

    Torque3D supports the Rift, but it seems to be easier to use on Windows with pre written examples being windows based. I did a windows screen grab of setting up Torque3D but wasn’t sure if it worked on Mac: http://www.youtube.com/watch?v=JgWqsYxZQ6M

    The latest version of the Source engine supports Oculus Rift, I haven’t tried it but I wonder if you could make a Half Life 2 Mod style thing for the rift.

    EDIT: I didn’t expect Disqus to auto-embed my videos!

    If you have a Windows partition you can download a Oculus Rift version of the UDK from the Oculus dev site, but last time I checked it was very buggy,

    I think the C++ library might be best suited for people making game engines etc as you have to deal with all the little stuff like tracking etc. Also, I expect the sdk to change quite a lot before release, so if C++ isn’t your thing you might want to let other people worry about that. Still, the C++ library is an option on the Mac.

    I’m still finding my way around at the moment, it would be really good to hear what other environments people find work well on the Mac. I’m hoping to do some work on three.js this week so I’ll keep you updated. Let me know if you find anything interesting out while you are looking at ways to prepare your Mac.

    Mac games: I would definitely try out Half Life 2 if you have it (if not Team Fortress is free), Surgeon Simulator is pretty funny too. When I’m showing it to my friends I like Parrot Coaster because they don’t have to do anything except sit still. Checking the top ten on http://www.riftenabled.com/ every so often is a good way to see what people are doing, mostly these are Unity based.

      Neil Galang · December 16, 2013 at 8:21 pm

      Thank you! Your reply is detailed and informative as well as the video about unity. I thought it was affordable at $75, but I also thought it was a one time fee. Bummer, with my creative cloud subscription, I don’t know if I will be able to float that after my trial expires.

      I will keep you posted for sure (maybe start my own dev blog) if I find anything worth knowing. Thanks again bud!

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

css.php