How to detect which screen is the OSVR headset?

219 views Asked by At

I have an WPF+SharpDX Windows application that displays to the OSVR HDK via a fullscreen window on the screen that is the HDK. This setup works well, but it requires users to state which screen the HDK is on.

I would like to have that automatically detected, but haven't seen anything in the API on which screen is the headset.

Currently I render in a window:

var bounds = dxgiDevice.Adapter.Outputs[_selectedOutput].Description.DesktopBounds;
form.DesktopBounds = new System.Drawing.Rectangle(
    bounds.X, bounds.Y, bounds.Width, bounds.Height);

And _selectedOutputis the thing I'm looking for.

I don't support direct mode at this time and I'm using Managed-OSVR. The application will run on Windows 8/8.1/10.

1

There are 1 answers

11
reden On BEST ANSWER

It's been a while since I coded anything for OSVR, but here's from what I remember: If you're running in extended mode, the OSVR is treated as a regular display. You can rearrange it as any other screen. The output location can be configured in the OSVR config file. I used the following (Java) to retrieve the position and size to set up my window:

osvrContext.getRenderManagerConfig().getXPosition()
osvrContext.getRenderManagerConfig().getYPosition()
osvrContext.getDisplayParameters().getResolution(0).getWidth()
osvrContext.getDisplayParameters().getResolution(0).getHeight()

To clarify: I don't know if you can retrieve the id of the display in extended mode. From what I know, it's only defined as a position and size on the desktop. I hope that it helps you, somewhat.