Skip to main content
New Participant
July 29, 2015

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

    Inspiring
    July 29, 2015
    What API (i.e. DirectX version or OpenGL) and OS platform are you on?
    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
    July 29, 2015
    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?
    Inspiring
    July 29, 2015
    Any reason you are using such an old SDK?
    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
    July 29, 2015
    Well it's not that old :?
    And i had some prolems with 0.6, so i decided to step back
    Inspiring
    July 29, 2015
    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);
    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
    July 30, 2015
    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().