Skip to main content
Up and Coming
August 6, 2014

SDK 0.4.0, DK1, direct to HMD and ovrHmd_AttachToWindow

Still using the DK1, I have updated my previous integration (0.2.5c) to the new 0.4.0 SDK, and everything is working fine using the extended desktop mode. However, I am having issues getting the direct to HMD rendering working in my application. Specifically, after calling ovrHmd_AttachToWindow (no error return value) I see no output going to the HMD, and my window continues to render the post-disortion eye views. I have, on one occasion, seen a bit of my VStudio window show up in a funky interlaced view in the HMD, but generally it just remains black.

I am doing client-side mesh distortion rendering (not using SDK rendering), in my own custom DX11-based engine.

It's worth noting that both the RoomTiny and WorldDemo sample do run fine in both extended desktop and direct-to-HMD modes. So clearly I am doing something divergent that is causing the issue.

I have taken care to duplicate the same initialization order as the tiny room demo, have verified I'm passing in the correct HWND handle, and have stepped through ovrHmd_AttachToWindow, although that seems to simply save the window handle off for later use.

Other differences that came to mind included my multithreading setup. Since my rendering is in a different thread than the one I create the HMD on, I tried postponing calling ovrHmdAttachToWindow until I was in my render thread, but that had no apparent effect. My actual window (and associated message pump) is created in yet another thread, but doing any initialization in that thread would be non-trivial.

So, generally speaking, are there any threading gotchas with initialization? Any requirements insofar as what thread you call ovrHmd_AttachToWindow in? Or just generally any thoughts on what might be going wrong (read: what *I'm* doing wrong)?

Other semi-pertinent info about my setup:
Visual Studio 2010 (Windows 8.1 SDK)
Windows 7 Professional 64-bit
Geforce 560Ti (332.21 drivers), single monitor

    16 replies

    August 7, 2014
    It would appear that the swap chain is a bit fragile in direct mode.


    My own further testing seems to confirm this. For example, if I attempt to resize the window while in Oculus mode (which causes a device reset), I get the same hang.

    Also, it seems that my issues may not be depth buffer related after all, and instead something wrong with the texcoords of my fullscreen quad when in Oculus mode. Continuing to look into it. If it's anything that's not specific to my engine I'll be sure to post the solution.

    EDIT: The UV issue was just an out of order problem. I was creating the vertex buffer for my full-screen effects before querying the resolution of the Oculus. This got messed up as I was moving things around trying to get enable/disable to work correctly.
    August 8, 2014
    I've posted about the hang in the "Report Issues" section:
    https://developer.oculusvr.com/forums/viewtopic.php?f=34&t=12122
    Up and Coming
    August 8, 2014
    Does this work in OpenGL as well, or is it only Direct3D9 that's supported?
    Kaetemi | Ryzom Core MMORPG Engine
    sbdykesAuthor
    Up and Coming
    August 8, 2014
    In previously searching through the forums for clues on this issue, I believe I saw that OpenGL should be supported with direct mode (on windows only), BUT AMD cards are not currently supported/working.
    Up and Coming
    August 8, 2014
    Can confirm AMD cards do not support OpenGL with Direct to Rift.
    Up and Coming
    August 8, 2014
    Well, great, I just happen to be using AMD and OpenGL.
    Kaetemi | Ryzom Core MMORPG Engine