Aframe/Three/WebXR: disable device orientation in VR mode - three.js

I am using AFrame 1.2.0 to develop a VR application and I am struggling with an issue for several days.
My goal is to allow the user to see a specific view that is set programmatically and that is absolutely unrelated to the current device orientation. In other words, I should:
stop the user see the world based on its device orientation;
force the user to see a specific point (which I set programmatically);
These steps basically mean I should be able to:
disable the user-device rotation (UNRESOLVED for VR-Mode )
set the view to a specific position with a "refresh" rate (DONE)
As I wrote, the issue is related to the first point: disabling the user-device orientation and it only affects the VR mode. Indeed, everything works properly when the view is NOT in VR-Mode, but when entering in VR-Mode I can't do it anymore.
I tried managing these framework/library/APIs:
AFrame, look-controls: I know it is possible to disable look-controls with some properties (e.g. enabled, magicWindowTrackingEnabled, magicWindowControls): it works, but only when the view is NOT in VR-Mode; (note that hmdEnabled is no more in AFRAME from 0.8v because, as far as I understood, the introduction of WebXR does not allow to manage device directly from AFrame);
THREE.DeviceOrientationControls: I know that under the hood the look-controls component uses this THREE-element, so I debugged it and tried to manage it directly (e.g. calling disconnect, dispose, enabled=false): again, it works but only when the view is NOT in VR-Mode;
WebXR: at the lowest lever, WebXR is the last API used. I debugged it and I try to manage the WebXR session, but everything is in Read-Only mode and it seems there is no function to activate/deactivate device sensors.
So, here the question: how to disable the device orientation in VR mode with AFrame/THREE/WebXR or whatever?
Thank you all.

Related

Oreo - View layout management has changed?

Don't flame me but prior to Oreo I used to put view in a static and keep it switching from fragments and it worked pretty well. In onCreate I simply check if the value of view is not null and in that case I was not inflating. It allowed me to do long task in a fragment in an async and switch to another fragment waiting for the async to complete.
It still works the same way with O except when I rotate the device. In that case I get a blank screen: no layout, no buttons, no text, etc.
I've read https://developer.android.com/about/versions/oreo/android-8.0-changes but didn't find anything.
Do you have an idea to fix this without changing it all?
From the way I understand it. if the Rotation is locked to portrait mode, rotating the device won't force it into landscape mode if portrait mode is locked.
Check out the following post:
android-p-feature-spotlight-rotation-can-temporarily-locked-landscape-changes
Just as annoying as Android Oreo, and unlike most OEM versions of Android I've used. There are new APIs for screen rotation in Android P so it's not clear whether apps need to implement it to be able to lock to landscape from the first go.
Also check out the Android P preview for more info regarding the rotation changes, for some reason it appears to be relevant for the Android Oreo as well.
Feature Overview
Behaviour Overview

MFC IVideoWindow put_FullScreenMode works incorrectly

So I have next problem:
I have two monitors and do video translation from web camera on one of them(secondary). I do it in full screen mode using
put_FullScreenMode().
It works fine but when I click any mouse button on area of primary monitor, window with video translation wrap into just window mode.
How can I save full screen mode working with primary monitor?
At the first, I move my video to the left (on secondary monito from primary) and use full screen mode.
if(monitors.GetCount() > 1)
gx.pVW->put_Left(primaryRect.right);
gx.pVW->put_FullScreenMode(OATRUE);
gx.pVW->put_Visible(OATRUE);
Thank you for your time.
[Much] older applications took advantage of FullScreenMode since API supplied a specific "full screen renderer" filter which efficiently took care of full screen presentation. Since then video adapters found their way into stretching of presented video and full screen mode become unnecessary. Windowed mode of video renderer (you are using) was also not a recommended mode compared to windowless any longer.
You would be better off using renderer in windowless mode right in your UI, in your window, form or dialog. Using borderless window hosting video renderer you can easily imitate full screen mode without actually change of display mode. Such window remains normal window and does not need to go back from full screen with another UI activity, e.g. such that happens on another monitor.
VMR filters themselves demonstrate the two ways of going fullscreen in their Filter Config property page:
Set Fullscreen does it the way you do and suffer from the mentioned issue. The other method does full screen mode using borderless window stretched to the extent of a monitor.
See also related discussion:
IVideoWindow::put_FullScreen returning only native video size

WebVR - How to display on the headset screen AND a monitor screen

I am displaying a WebVR scene in a browser.
But only the user with the headset (an oculus rift) can see the scene.
My question :
Is there a way to see on another screen what the user see ?
I would like to give advices to the user (you can do that, you can go here too, etc).
Thanks
I use Open Broadcaster Software which can capture external monitors (like the Rift in extended mode) and individual windows. It's typically used for recording and streaming but you can use it for mirroring with its "Preview" mode. This works pretty well usually, although it does take some time to setup correctly and can be temperamental.
There are a couple of reddit posts about setup tips:
"Guide: Mirroring Rift display using OBS" by hargabyte: https://www.reddit.com/r/oculus/comments/2d1ujo/guide_mirroring_rift_display_using_obs
"My recording settings for DK2 apps using OBS" by eVRydayVR: https://www.reddit.com/r/oculus/comments/2gerrj/my_recording_settings_for_dk2_apps_using_obs/

programatically requesting a specific display orientation?

Is it possible to programatically set the display to a specific orientation?
I'm converting middleware code that on some platforms like Android use functions (like Activity::setRequestedOrientation()) that lets the developer change the display's orientation at any time in the application. Is it possible to do the same in Metro? Or do I only have access to the display through orientation change events?
My application is a fullscreen Direct X app.
Thanks!
You need to set the autorotation preferences, I believe:
http://msdn.microsoft.com/en-us/library/windows/apps/windows.graphics.display.displayproperties.autorotationpreferences.aspx
These will allow you to set your current orientation; However, if you've got more than one set, then it will clearly pick that which it believes the device is currently set in.
Be aware that your app could be running on a device which doesn't support rotation -- e.g. desktop.

Core Animation in Interface Builder

So, I'm working on a mac app, and I'm trying to add a shadow via core animation to a button. I used the effects pane in Interface Builder and set the shadow and color, and made sure to check the "Want's Core Animation Layer" checkbox. But when simulating the interface or building the app, there is no shadow. I would appreciate it if someone knows what's wrong.
Thanks!
Edit: I've tried several things, including cleaning the project and turning on and off core animation. Nothing fixes it.
I fixed it. I ended up going through every interface element in the tab view and turned off core animation on each one (I had some strange transparency stuff going on). Then I went back to add the shadow, and it worked fine.

Resources