Skip to main content
Up and Coming
August 25, 2014

Swapchain presenting to window, yet no blue light

My display mode is set to "Direct HMD Access from Apps" and the OculusRoomTiny sample works fine. It initializes, then on the 3rd or so call to ProcessAndRender ( specifically the RParams.pSwapChain->Present(swapInterval, 0) call ) the device kicks in, the blue light goes on and whatever is on the swap chain is shown on the HMD.

Now in my own app, I've got everything set up almost the same, everything is rendering fine, and the final image is warped to my swap chain and displayed in my window, but the device never kicks in, light stays yellow and nothing is sent to the HMD.

So in the tiny sample, what exactly prompts the device to know the swap chain is setup for the HMD? I was assuming it was the ovrHmd_AttachToWindow(HMD, window, NULL, NULL), call and the fact the swap chain is also set to that window.

Here's my window creation code...

WNDCLASS wc;
memset(&wc, 0, sizeof(wc));
wc.lpszClassName = "OVRAppWindow";
wc.style = CS_OWNDC;
wc.lpfnWndProc = ::DefWindowProc;
wc.cbWndExtra = NULL;
RegisterClass( &wc );

HWND HWindow = CreateWindow( "OVRAppWindow", "OculusRoomTiny", WS_POPUP | WS_VISIBLE | WS_OVERLAPPEDWINDOW, 0, 0, m_OculusHMD->Resolution.w, m_OculusHMD->Resolution.h, NULL, NULL, ::AfxGetApp()->m_hInstance, NULL );
m_Oculus_Window.Attach( HWindow );

ovrHmd_AttachToWindow( m_OculusHMD, HWindow, NULL, NULL );

I'm also calling the ovrHmd_BeginFrame(HMD, 0) and ovrHmd_EndFrame(HMD, eyeRenderPose, &EyeTexture[0].Texture) and the image is being presented to my window fine.

Any idea what I'm missing here?

Thanks

    17 replies

    kojack
    Honored Contributor
    August 28, 2014
    "ScottieBizzle" wrote:
    My swapchain is in windowed mode since I don't want that window taking over my monitor or anything. At least with "Extend Desktop to the HMD" I was able to go fullscreen without having to see the dummy window.

    I'm looking for a way around this at the moment.
    So far I've found that you can call ShowWindow(hwnd, SW_HIDE);
    This will remove the window from your desktop, but the rift will still get it's direct feed from it.
    The only downside I've seen so far is that also removes your program from the task bar, so you can't tell it's even running without using task manager. (I haven't tested performance, my current test project just draws a white quad, no distortion, and does head tracking)

    I'm going to try using two windows. One for a general menu interface or mono view for use with monitors and a second window with the direct mode and SW_HIDE flag for only rift view.
    Author: Oculus Monitor , Auto Oculus Touch , Forum Dark Mode , Phantom Touch Remover , X-Plane Fixer Hardware: Threadripper 1950x, MSI Gaming Trio 2080TI, Asrock X399 Taich Headsets: Wrap 1200VR, DK1, DK2, CV1, Rift-S, GearVR, Go, Quest, Quest 2, Reverb G2, Quest 3
    Up and Coming
    August 28, 2014
    Hidding the window for their Tiny sample doesn't work. Just tried hiding my dummy oculus window with my app and the HMD kicks in but is viewing the screen where my app is running, and not picking up the swap chain. I don't think hidding it will work. I also had major jerkiness and thought it was because my window was off screen, so I kept it at the top left and made it smaller and it was still jerky, I then made sure my app or any other window was not covering it and the jerkiness was gone. I then tried maximizing my app on another window and the jerkiness came back. The jerkiness is only when connected to the HMD.

    Long story short, I've now got my window sized to 192x108 and pushed it off screen out of view, and when my app is not maximized it runs super silky smooth, the minute I have it maximized everything is jerky. I know I sound like a nut but just trying to report what I'm seeing as it may help others debug similar issues and find a work around.

    Gonna try a few more things...
    "Never trust a computer you can't throw out a window" - some old guy
    Up and Coming
    August 28, 2014
    Would be nice if the SDK could also just take a render target and deal with the swapchain stuff for apps that use multiple windows and offscreen targets and don't care to see the final warped image.
    "Never trust a computer you can't throw out a window" - some old guy
    Up and Coming
    August 28, 2014
    Converted my code back to using SwapChain1 and DXGIFactory1, and a 1x1 window. Still gets choppy the minute I maximize my main app window, if I unmaximize it, it's fine, again only when the HMD is used. I'm not doing anything different in my app when things are maximized and my app is using my own DX11 user interface and all windows/panes are drawn into one base window's render target.

    Very odd. Maybe I'll try to rig the Tiny demo to launch a second window with a swapchain to mimic what I'm doing and see how that goes...

    ALSO: if I move my app to my second monitor, it's silky smooth both maximized and non-maximized, it only gets super jerky when on the primary window and maximized, which kinda rules out anything weird happening in my app code. Probably gonna have to start another thread for this one...

    Scott
    "Never trust a computer you can't throw out a window" - some old guy
    kojack
    Honored Contributor
    August 28, 2014
    "ScottieBizzle" wrote:
    Hidding the window for their Tiny sample doesn't work.

    Hiding the window of the tiny room demo works just fine for me.
    ShowWindow(window, SW_HIDE); placed directly after the ovrHmd_AttachToWindow call in Win32_OculusRoomTiny.cpp makes the window go away but the demo continues to run fine on the rift.
    Author: Oculus Monitor , Auto Oculus Touch , Forum Dark Mode , Phantom Touch Remover , X-Plane Fixer Hardware: Threadripper 1950x, MSI Gaming Trio 2080TI, Asrock X399 Taich Headsets: Wrap 1200VR, DK1, DK2, CV1, Rift-S, GearVR, Go, Quest, Quest 2, Reverb G2, Quest 3
    Up and Coming
    August 28, 2014
    I was calling it before, but just tried adding ShowWindow( window, SW_HIDE ) immediately after ovrHmd_AttachToWindow and it hides the window but the HMD light stays yellow and doesn't kick in. Not sure how it's working for you. What monitor configuration are you using?

    I have two 27" 1440p monitors. My left one was primary. I tried making my right one primary and launch Tiny and the blue light kicks in, but the display is black. Removing the ShowWindow( hide ) works either way.

    Some weird stuff going on...
    "Never trust a computer you can't throw out a window" - some old guy
    kojack
    Honored Contributor
    August 29, 2014
    Mine's two 22" monitors with left as primary. One monitor dvi, one display port and the rift on hdmi. Also windows 7 64 bit and nvidia geforce 680.
    Author: Oculus Monitor , Auto Oculus Touch , Forum Dark Mode , Phantom Touch Remover , X-Plane Fixer Hardware: Threadripper 1950x, MSI Gaming Trio 2080TI, Asrock X399 Taich Headsets: Wrap 1200VR, DK1, DK2, CV1, Rift-S, GearVR, Go, Quest, Quest 2, Reverb G2, Quest 3