Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Window position...

LastBlowLastBlow Posts: 15
NerveGear
edited November 2019 in Oculus Rift S/Rift Development
Hey, hey, hey! In SDK 0.4, I believe, ovrHmd used to have WindowsPos as a member.
Resolution apparently remained as a member and gives the size of the window.

Only, how to access the position of a window in SDK 0.6?

Please, see code here below, thank you! ;-)

if (debug == false)
{
x = hmd->WindowsPos.x;
y = hmd->WindowsPos.y;
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}

int w = hmd->Resolution.w;
int h = hmd->Resolution.h;

Comments

  • MatlockMatlock Posts: 98
    If you have the hwnd, you can use the windows function

    RECT rect;
    GetWindowRect(hwnd, &rect);
  • jhericojherico Posts: 1,420
    Nexus 6
    LastBlow wrote:
    int w = hmd->Resolution.w;
    int h = hmd->Resolution.h;

    Technically this code is incorrect. hmd->Resolution gives you the native resolution of the display, not the actual resolution it's currently running at. If you're running in extended mode it's possible to set the headset to pretty much any resolution you like, so in 0.4 you should really be querying the platform for the resolution of the Rift monitor once you have it. Of course, almost no one runs the HMD in anything other than 1920x1080, so it doesn't really matter, and in SDK 0.6 it's a moot point as there's no way to identify which monitor is the Rift or even if it's in extended mode.

    LastBlow wrote:
    Hey, hey, hey! In SDK 0.4, I believe, ovrHmd used to have WindowsPos as a member.
    Resolution apparently remained as a member and gives the size of the window.

    Only, how to access the position of a window in SDK 0.6?

    You don't. In 0.6, regardless of whether you're running in extended or direct mode, the SDK itself creates the Rift output surface. You're only responsible for any non-Rift windows, so you don't have any need for the Rift position (which is only valid if the user is running in extended mode anyway).
    Brad Davis - Developer for High Fidelity
    Co-author of Oculus Rift in Action

Sign In or Register to comment.