Toggle On / Off HMD Rendering

Hey folks!
I hope you can help me with a problem I’m struggling with from a couple of days:

Basically my application requires user to provide some personal information before getting started with VR, and this process is done by filling some textfields in a UI Widget.

Because of this, VR cannot be enabled immediately at application lunch.

Once players goes through this process, I would need to display a message asking them to continue in the headset, so VR stereo rendering should be enabled only at this point.

My question is:
Is it possible to dynamically toggle on / off in headset VR stereo rendering using C++?

Tried many different approaches launching the commands “hmd enable” and “stereo on”.

GetWorld()->Exec(GetWorld(), TEXT("hmd enable"));
GetWorld()->Exec(GetWorld(), TEXT("stereo on"));

or also calling the related methods directly on the HeadMountedDisplay class, but none of them worked for me.

Please help. I have no idea what I’m doing wrong.

A couple of infomation on my system:

  • Win 10
  • Oculus Rift
  • Unreal 4.13.0

Thanks in advance for any feedback.

After digging in UE4 source code today to understand more about how the Editor VR Preview works, I’ve found some useful GEngine functions I wasn’t aware of, so I’ve tried to make some more tests, but unfortunately without success.

What I’ve notice is that the function


Returns **true **after running the application in the Editor and **false ** if running as a Standalone game.

However, running as a Standalone game is not the top most priority for me at the moment, as long I’m able to test it at least in the Editor, so I’ve tried to execute these lines of code to enable stereo rendering in the editor

if (GEngine->HMDDevice.IsValid()) {

But nothing happen…My Oculus still display black screen.

PS: Editor VR Preview works perfectly fine!

Any thoughts?

Please help.