Forum Discussion

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

Switch Rendering on/off several times

Hello there,

i do have a very basic console application which should create, do some rendering and shutdown an hmd on key press - and then start do it again. This happens in a extra thread.
This works fine for the first time, but afterwards i only see the mirrored window, but the oculus itself stays black.

I create the oculus with
ovr_Initiliaze();
ovrHmd_Create(0);
..do rendering..
ovrHmd_ConfigureRendering(hmd, NULL, 0, NULL, NULL);
ovr_AttachToWindow(hmd, NULL, NULL, NULL);
ovrHmd_Destroy(hmd);


Does anyone of you know may have experience with that?

Thanks in advance!

6 Replies

  • What API (i.e. DirectX version or OpenGL) and OS platform are you on?
  • I'm using D3D11 on Windows 7/8.1 and the Oculus SDK 0.5.

    Furthermore: when destroying the HMD, i also release all buffers necessary to do the rendering and create them again when i need them.

    Is it even possible to create/destroy the hmd several times during the runtime of one application?
  • Well it's not that old :?
    And i had some prolems with 0.6, so i decided to step back
  • Well, I would advice not using the old SDK, but that may not even be your issue.

    Looking at your code sample, and the comments in the SDK, I found this.

    /// Upon success the returned ovrHmd* must be freed with ovrHmd_Destroy.
    /// A second call to ovrHmd_Create or ovrHmd_CreateDebug with the same index as
    /// a previously successful call will result in an error return value if the
    /// previous Hmd has not been destroyed.

    So I think you need to call it like this:

    ovr_Initialize(nullptr);
    ovrHmd HMD;
    ovrHmd_Create(0, &HMD);
    ...
    ovrHmd_Destroy(HMD);
  • But this is exactly what i do. I do have a new hmd as soon as i start the next iteration. But still, after creating a new hmd the oculus stays black. :(

    BTW.: Using the extended mode works perfectly, just direct to rift mode seems to have this problem. So i assume that the problem is somewhere around ovrHmd_AttachToWindow().