Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
mindabuse's avatar
mindabuse
Explorer
12 years ago

DK2 Initialization, OS X with SDK v0.3.2 Preview 2

So I just got my DK2 to initialize via ovrHmd_Create() on OS X with SDK v0.3.2. Basic DK1-style rotation sensor works.

Here's the fix:

OVR_OSX_HMDDevice.cpp
line 218


// original code
if (vendor == 16082 && ( (product == 1)||(product == 2) ) ) // 7" or HD

// change line to the following
if (vendor == 16082 && ( (product == 1)||(product == 2)||(product == 3) ) ) // 7" or HD


Hopefully this helps anyone make use of their hardware on OS X until its SDK v0.4.0+ comes out....

3 Replies

  • Oh, and if you'd like to use ovrHmd_CreateDebug() with DK2, it's another one-liner:

    OVR_Stereo.cpp
    line 592


    // change the following if...
    if ((hmdType != HmdType_DK1) &&
    (hmdType != HmdType_CrystalCoveProto))

    // ...by adding HmdType_DK2
    if ((hmdType != HmdType_DK1) &&
    (hmdType != HmdType_CrystalCoveProto) &&
    (hmdType != HmdType_DK2))
  • One more DK2 v0.3.2 SDK hack to add, for those of you using SDK-based distortion rendering, (using ovrHmd_ConfigureRendering, ovrHmd_BeginFrame, ovrHmd_BeginEyeRender, ovrHmd_EndEyeRender, ovrHmd_EndFrame)....

    There is a bug somewhere that I haven't yet tracked down to the absolute source (no pun intended). So I've stubbed in a gross hack that I think works just as fine (I guess)?

    Open up CAPI_HMDRenderState.cpp
    line 39 of HMDRenderState::HMDRenderState


    // change the following line....
    RenderInfo = GenerateHmdRenderInfoFromHmdInfo( HMDInfo, userProfile );



    // FIXME: HACK
    if ( hmdInfo.HmdType == HmdType_DK2 ) {
    // the "real" DK2 HMDInfo has an incorrect CenterFromTopInMeters value,
    // but the debug HMDInfo appears correct. so hack in the debug version.
    RenderInfo = GenerateHmdRenderInfoFromHmdInfo( CreateDebugHMDInfo( HmdType_DK2 ), userProfile );
    } else {
    RenderInfo = GenerateHmdRenderInfoFromHmdInfo( HMDInfo, userProfile );
    }


    The original code resulted in the distortion rendering cutting off the screen. I compared the entire populated HMDInfo data/class structure between "real" and debug versions and found that only CenterFromTopInMeters was different, as well as the resulting calculated distortion (based off of that value).

    Happy hacking, I guess? :d
  • "mindabuse" wrote:

    The original code resulted in the distortion rendering cutting off the screen. I compared the entire populated HMDInfo data/class structure between "real" and debug versions and found that only CenterFromTopInMeters was different, as well as the resulting calculated distortion (based off of that value).

    Happy hacking, I guess? :d


    I found the 'more correct fix' and applied it to my SDK here: https://github.com/jherico/OculusSDK/commit/4a9a2f619d0ec60ddfa8cd792381f90466470028

    It's the third change in the commit, the one in the OVR_OSX_HMDDevice.cpp. Someone was passing in 'half the screen width' where 'half the screen height' should have been used.