Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
jiahuipeng's avatar
jiahuipeng
Honored Guest
9 years ago

How to Integrate Oculus SDK with Third-Party 3D Engine( Unigine Engine), mainly focus on DX11 ?

Dear Oculus Engineers and Developers,
  I'm integrating Oculus rift CV1 with a Third-Party Engine: Unigine.
  The Unigine itself has a plugin doing the integration, while the engine version we're using is too old to support the current Oculus SDK. And we have to use the current old version, for some unique features, though we have new version installed...
  I followed the SDK's Developer Guide.pdf to integrate... 

Note: the engine has two rendered texture output: Unigine::Texture texture[2]

->Create ovrSession and Device
->Create ovrSwapChain and Buffers
->Set up Viewport
->Copy Unigine-rendered Textures to ovrSwapChain...
->Commit the change and set layer to submit

  Now what I'm getting is a totally black view in HMD :(  
  Since I'm new to Oculus ans DX11, what I've tried is to copy the rendered texture to swapchain to submit. Now I think the key is how to copy ID3D11Texture2D. And I think maybe the renderTargetView setting is wrong too, but have no idea how to fix.

  Waiting for yours kind advice, solution is better~
  I can share my poor code, if needed.

  Thank you in advance
  Huipeng Jia.

2 Replies

  • @imperativity,


    Sorry for late reply..

    I have checked the older version SDK: the first one is 0.8.0.0-beta, while our current engine targets even older version
    (seems 0.4, I searched the API change list).

     I paste some code here for your reference:


    AppOculus.h :
    #ifdef HAVE_OCULUS

    OVR::Ptr<OVR::DeviceManager> manager; // manager
    OVR::Ptr<OVR::HMDDevice> hmd_device; // hdm device
    OVR::Ptr<OVR::SensorDevice> sensor; // sensor
    OVR::SensorFusion fusion; // fusion

    #endif

    AppOculus.cpp :
    #ifdef HAVE_OCULUS	
    OVR::System::Init();
    manager = *OVR::DeviceManager::Create();
    hmd_device = *manager->EnumerateDevices<OVR::HMDDevice>().CreateDevice();
    if(hmd_device != NULL) {
    // device sensor
    sensor = hmd_device->GetSensor();
    if(sensor) {
    sensor->SetRange(OVR::SensorRange(9.81f * 4.0f,UNIGINE_PI * 8.0f,1.0f),true);
    fusion.AttachToSensor(sensor);
    }

    // device parameters
    OVR::HMDInfo hmd_info;
    hmd_device->GetDeviceInfo(&hmd_info);

    oculus_width = (int)hmd_info.HResolution;
    oculus_height = (int)hmd_info.VResolution;
    ......
    #endif
    I couldn't get the 0.4 version to test.
    And one more question: Does the Oculus Runtime support all versions SDK?

    Thanks & BR.

    Huipeng Jia
  • Hi, 
    I have fixed it myself...
    Just set the ovrSwapChain to be the renderTarget

    1st-Nov-2017
    Huipeng Jia