Mirrored VR Window doesn't want to Maximize neither go fullscreen


I’m currently working with the HTC Vive but I can’t manage to get my mirror window in Fullscreen or WindowedFullscreen. Even the Maximize() function doesn’t work properly (my window is almost maximized, but it’s a bit too big. But it does maximize properly when I manually do it from Windows).

This issue only happpens when the Vive is plugged in. If I unplug it, and switch to EWindowMode::WindowedFullscreen, my client window is properly placed and sized.

GEngine->GameViewport->GetWindow()->MoveWindowTo(FVector2D(2560, 0));
GEngine->GameUserSettings->SetScreenResolution(FIntPoint(2560, 1440));

This function doesn’t work at all by the way :-/. It just does nothing.

GEngine->GameUserSettings->SetWindowPosition(2560, 0);

I’m running my project on a triple screen setup on 2560*1440 monitors powered by a Titan X.
Any ideas ?

PS: This issue seems to exist for a long time Mirrored screen on 4.8

All right guys. After updating to the 4.12 everything works fine ! I have my mirrored VR window in WindowedFullscreen as exepected.

Here is my final code

GEngine->GameViewport->GetWindow()->MoveWindowTo(FVector2D(0, 0));

APlayerController* PController = UGameplayStatics::GetPlayerController(GetWorld(), 0);
PController->ConsoleCommand(TEXT("stereo on"), true);


Firstly,thank you for what your shared!

I try to copy this code into 4.12 gamemode.cpp ,and Include #include “Engine.h” to solve the errors about “GEngine”.Then I override gamemode on WorldSetting, nothing happen .Do i miss some steps?

I also use HTC vive to test.

Thans for your reply!

Wait what? Did you just past this sample of code into the engine code itself ?

I just put the code to my project code ,no engine code. Where should I put the code to ?

thank you!

Oh okay that’s sound better :D.
Well I think the best place to put this is in your GameInstance class. For example. For example you could put it in your GameInstance::Init() function.

Sorry ,when I declare “void init() override;” in MyGameInstance.h and define it in .cpp, there are some error following:

And when I use code which contain “GEngine”, there is also LNK2019 error.

I am a newbie ,Thanks for your help!!! :slight_smile:

// Begin UGameInstance interface
/** GameInstance is initialized */
virtual void Init() override;
// End UGameInstance interface

You’ve forgot the virtual keyword.
Is your class inheriting from UGameInstance ?

About the GEngine issue, it should just work out of the box if you’ve generated you C++ class from the editor properly.

I built the code successfully. And I set my_GameInstance in project setting->map & modes-> GameInstance. Then I play the game. But nothing happen.image is following:

How did you play the game ? From the editor ? From the executable itself ?
If you play from the editor, make sure to build using “DevelopmentEditor” configuration in Visual Studio.
However, playing from editor is bad for testing low level stuff like window management and so on cause lot of things are just ignored.

If you just want to test your window management, try to build from Visual Studio using the “Development” configuration. This will generate a executable in Binaries/Win64/XXX.exe. From there you should be able to test the previous code :wink:

yes,I play the game from the editor.

Acoording your mathod, I try to build from Visual Studio using the “Development” configuration .there is a error when open the executable in Binaries/Win64/XXX.exe ,like the following image.

I think the GameInstance is just ignore while playing in the editor.

About your crash. Come on. Debug it. Visual Studio, breakpoints. Probably a segmentation fault. I suspect PController to be NULL when you try to use it.
If there are not controller when the GameInstance is Init(), then you have to enable stereo later in your program execution.

OK,Thank you. I’ll try.

Best regards,

Keep me in touch. We will make it work!

I set “stereo on” in level blueprint, and built it in "development " mode ,ffatal error also when open it . I also pacage it ,and open the executable file.,but crash.

here is my project.maybe you should reset gameinstance.
link text

So where does the crash occurs ? Just run your project with Visual Studio and check where it happens.

I set “stereo on” in level blueprint, and built it in "development " mode ,fatal error when i open it . I also package it ,and open the executable file.,but crash.

Here is my project.maybe you should reset gameinstance.

link text

maybe I should use other time to test it.

thank you.

here is crash imformation :


You do not have any debugging symbols required to display the callstack for this crash.

Oh I see. You have to install the symbols when installing the Engine. Otherwise you won’t be able to debug anything from Visual Studio (which is fine when you only want to use blueprints). I suggest you install the debug symbols (Google “unreal engine debug symbols”).

OK thank you.i’ll try