Skip to main content
Inspiring
March 5, 2013

Minimal Oculus Application Tutorial

Hey guys!

I put together this simple tutorial, showing the bare minimum code needed to work with the Oculus SDK.

https://developer.oculus.com/wiki/index.php?title=Minimal_Oculus_Application

It's basically just a console application that prints out some values from the headset. This could be a good place to start if you are confused about what is part of the SDK and what is just part of the demos. It also shows how simple it is to work with the SDK. Of course, it won't show how to handle stereo 3D, or distortion, or all the complex stuff. But it's a start.

Hope that helps,

- Andres

Updated tutorial for 0.3.x SDK:
https://developer.oculus.com/wiki/Minimal_Oculus_Application_0.3.x

    33 replies

    Inspiring
    May 14, 2014
    I need to update the wiki to the latest SDK. Please give me a moment.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Inspiring
    May 14, 2014
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    New Participant
    May 30, 2014
    I've tested your application and I some constants aren't recognized.

    In this line:
    ovrHmd_StartSensor(hmd, ovrHmdCap_Orientation | ovrHmdCap_YawCorrection | ovrHmdCap_Position | ovrHmdCap_LowPersistence, ovrHmdCap_Orientation);


    I found those constants in the OVR_CAPI file, as follows:

    typedef enum
    {
    ovrSensorCap_Orientation = 0x0010, // Supports orientation tracking (IMU).
    ovrSensorCap_YawCorrection = 0x0020, // Supports yaw correction through magnetometer or other means.
    ovrSensorCap_Position = 0x0040, // Supports positional tracking.
    } ovrSensorCaps;


    So, if I change the line above to

    ovrHmd_StartSensor(hmd, ovrSensorCap_Orientation | ovrSensorCap_YawCorrection | ovrSensorCap_Position | ovrHmdCap_LowPersistence, ovrSensorCap_Orientation);


    it works.

    --
    Is it possible to capture those values while I am trying an example at the same time :?:
    Inspiring
    May 30, 2014
    Ah yes, there were some changes in 0.3.2 that broke this example.

    Thanks for bringing this to my attention.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Inspiring
    June 2, 2014
    "provezano" wrote:

    ovrHmd_StartSensor(hmd, ovrSensorCap_Orientation | ovrSensorCap_YawCorrection | ovrSensorCap_Position | ovrHmdCap_LowPersistence, ovrSensorCap_Orientation);


    Don't pass in anything that isn't an "ovrSensorCap_" capabilities into StartSensor. In particular, ovrHmdCap_LowPersistence isn't part of the sensor capabilities. Since these are bitfields, injecting a bitfield from the wrong type can erroneously turn on or off some feature you didn't expect.

    Also, you don't need to duplicate anything in required that is already in supported, unless you explicitly want the function to return false and not start the sensors if it's not supported.
    Brad Davis - Developer for High Fidelity Co-author of Oculus Rift in Action
    Inspiring
    June 2, 2014
    OK, I updated the tutorial. The line should look like this:

    ovrHmd_StartSensor(hmd, ovrSensorCap_Orientation| ovrSensorCap_YawCorrection | ovrSensorCap_Position, ovrSensorCap_Orientation);
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    New Participant
    June 3, 2014
    How about my question?
    Is it possible to capture those values while I am trying an example at the same time :?:

    I mean... I can use and capture the coordinates from my mouse at the same time, is it possible to do the same with Oculus? Because I tried that example and the Oculus becomes unavailable for another application.
    Inspiring
    June 3, 2014
    Currently only one application can interface with the Rift at a time.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Up and Coming
    June 8, 2014
    "cybereality" wrote:
    Currently only one application can interface with the Rift at a time.

    Unless that application is a USB multiplexer, such as is commonly used to feed a USB webcam video stream to multiple apps. This method could work for the Rift as well. It is not that hard to find a way to get beyond artificial limitations like your "only one application" constraint.
    This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
    New Participant
    June 11, 2014
    A little question about the tutorial:

    To get this to work I also have to explicitly link to "shell32.lib" and "gdi32.lib", even though they are totally in the inherited values. If I don't link those two specifically I get Linker failures.

    I've noticed that the OculusTinyRoom also explicitly links everything inherited in again. Is there a reason for this?