Forum Discussion

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

Win8 - Starting on the right screen

I've received today my devkit and wonder how you guys are doing the startup of a game. I set the Rift as primary monitor and have as second my normal screen. Now when I launch any with the mouse on the main screen, it will show up there, not on the Rift. Is there any obvious way to have a game start on a specific monitor?

(sorry, long time Mac user fresh on Win8 world) :-)

Or can I have the Rift as secondary screen and launch stuff just there?

6 Replies

  • "MartinSchultz" wrote:
    I've received today my devkit and wonder how you guys are doing the startup of a game. I set the Rift as primary monitor and have as second my normal screen. Now when I launch any with the mouse on the main screen, it will show up there, not on the Rift. Is there any obvious way to have a game start on a specific monitor?

    (sorry, long time Mac user fresh on Win8 world) :-)

    Or can I have the Rift as secondary screen and launch stuff just there?

    End user info:

    Some Rift apps only start on the primary monitor. Others let you choose which monitor to use. The best ones locate the Rift and use it automatically.

    For programs that insist on using the primary monitor (such as those using the older 1.x SDL libraries), you have a couple of options:

    1) You can tell Windows that the Rift is the primary monitor. But that is annoying because most popup windows go there and are hidden from the "real" desktop monitor.

    2) Although recommended against in the Oculus "best practices" guide (for performance reasons), you can duplicate the Rift monitor with the main desktop monitor. Although much more convenient, this has a number of disadvantages. One is that you can have tearing caused by VSYNC issues (if they are active). Another is that it reduces the size of the main monitor to what the Rift can support. Some developers like that mode, using the maximum 1920x1200 that the Rift can use (downsampled to 1280x800 in the Rift hardware), so they can quickly and freely use both the main monitor and their Rift just by putting their face up to the Rift for a quick test of their code, which most of the development happens on the main display. But for me that method has a big problem: I rely on subpixel rendering (in fact, it is critical for my application), and that requires that the Rift always be in its native 1280x800 resolution (which also renders the best possible image quality under all conditions). The Rift hardware is rather underpowered to do a good job of downscaling. Although sufficient for development work, I would NEVER use Rift downscaling for a real application!

    I switch between making my Rift the primary monitor, or duplicating it with my desktop monitor, but always at 1280x800 resolution (despite the cramped desktop space at that resolution).

    You should try the various options and decide which is best for you (depending on which apps you run), and what image quality you desire. Just remember, your video card can do a MUCH better job downscaling to 1280x800, than the tiny Rift controller chip can do when you send it a non-native (not 1280x800) resolution.

    Developer info:

    Most apps code the "fullscreen" window coordinates to start at (0,0), which is the upper left corner of the primary monitor. When a program enums the monitors, it gets a list of all their sizes and starting coordinates. Any monitor above or to the left of the primary monitor has negative coordinates. When you define a fullscreen window, you can specify the starting coordinates of any monitor. You can also specify a wider width and height to span across more monitors, or even all monitors, so that drawing to this one window draws on all fullscreen monitors. Technically, a fullscreen window is just a normal window set to always be on top and to have no controls or windows decorations. You can even define and draw to a window that does not span across any monitors (completely hidden). However, the Microsoft documentation recommends not using monitors unless the Windows desktop is extended to them, so of course I need to try that one of these days to see what happens!
    :D
    EnumDisplayMonitors() function:
    http://msdn.microsoft.com/en-us/library/windows/desktop/dd162610(v=vs.85).aspx
    CreateWindowEx() function:
    http://msdn.microsoft.com/en-us/library/windows/desktop/ms632680(v=vs.85).aspx

    Or, if you don't mind the requirements and dependencies that result from using the Oculus SDK, you can use this to find your Rift monitor: OVR::DeviceManager::EnumerateDevices<>

    EDIT: The above "Developer Information" describes how I like to draw to the windows desktop (the bounding box containing all of my monitors). Most Windows programming tutorials draw directly to the monitors instead, which clips your window to the boundaries of that monitor. There are many ways to accomplish getting content onto the monitors, but I like the freedom I get from drawing directly on the Windows desktop. You can choose whatever method you want, or just use whatever your application framework provides for you.
  • Whoa, what a complete answer. Thanks, the replicate mode was what I was looking for. I will do the development on the Mac mainly and probably do the Rift testing on the PC then. (although Mac drivers are now available as we know)
  • I believe the C++ demos can target the Rift screen (as a secondary monitor) by pressing F9.

    With the UDK demos the key to do this is F11.

    With Unity it is a little more complicated. You can drag the game window onto the Rift and maximize it, and that should be OK for development testing. When running the exe you will have to either have to make the Rift primary, or set the displays to duplicate mode. In Windows 7 there is a trick you can do with creating a shortcut to the app and then adding "-Adapter N" to the launch string (where N is you display number, i.e. 1). I don't think this will work on Win 8 though.
  • Some apps have a -w or -win command line option (or -f for fullscreen) and may allow you to select a display, but there is no real standard. It is up to the program author if or how to allow a user to select a specific monitor. About the only standard control you have that can be trusted is setting the shortcut up to start an app up in Minimized mode, but even that depends on if the program author is passing the "nShow" (or "iShow") parameter from WinMain() through unmodified to ShowWindow(), which is not always the case. Many Windows programs do not even process command line parameters at all. So realistically, there is no standard, and sometimes you can only rely on making the Rift be the primary monitor, or a duplicate of the primary monitor. Not all apps support running in a Window, but if they do you can often drag them to the display of your choice and fullscreen them (Alt-Enter) as cybereality described. And to exit many fullscreen apps, you may need to press Alt-F4.
  • owenwp's avatar
    owenwp
    Expert Protege
    I wasn't aware of the adapter switch in Unity, thats handy. Unless Unity adds script controlled adapter selection, it might be worthwhile to make a lightweight launcher tool for Unity that detects the rift and passes the correct number through the command line.

    And it does work in Windows 8.
  • With the 0.4.3 SDK you can directly access the extended mode screen coordinates of the rift via the WindowsPos vector in the ovrHmdDesc which enables you to do something like:


    SetWindowPos(ancestor, 0, myHMD->WindowsPos.x, myHMD->WindowsPos.y, myHMD->Resolution.w, myHMD->Resolution.h, 0);