Game Development Community

Full-screen/border-less over multiple monitors

by Nathan Bowhay - ESAL · in Torque 3D Professional · 01/06/2015 (5:34 pm) · 4 replies

I was wondering if anyone has gotten full-screen to work over more than one monitor. My Other thought was to just make the window border-less and then stretch it over several monitors.

I found hideWindow under GuiCanvas, but it seems to hide the entire window not just the border and I can't figure out how to get it back. My other thought was to just use: Canvas.setVideoMode(2880, 1024, true, 32, 60, 4); This should set it to full screen with the correct width/height for everything, but I get an error (Failed to create D3D Device).

#1
01/06/2015 (6:45 pm)
According to Multiple full-screen windows with DirectX 9.0 discussion you'll need multiple Direct3D canvases, one for each monitor/adapter, and attached them all to one Direct3D focus window in order to do proper full screen on more than one monitor.

So that means some device context changes will have to be made to the Direct3D 9 GFX device sources. Now I know of one other project that had to workaround this hurdle, The Virtual Reef, and so happens the sources to that project were released on github. Beginning with this commit there's several changes directly related to borderless window handling from what I understand.
#2
01/07/2015 (2:18 am)
I have few client using multiple monitors with border-less windows:

Add this to Win32Window.cpp

void Win32Window::setVideoMode( const GFXVideoMode &mode, bool border )
{
	mWindowedWindowStyle |= WS_OVERLAPPEDWINDOW | WS_THICKFRAME | WS_CAPTION;
	if(!border)
		mWindowedWindowStyle ^= WS_OVERLAPPEDWINDOW | WS_THICKFRAME | WS_CAPTION;
	setVideoMode(mode);
}

In guiCanvas.cpp add the border option:
ConsoleMethod( GuiCanvas, setVideoMode, void, 5, 9,
               "(int width, int height, bool fullscreen, [int bitDepth], [int refreshRate])\n"
               "Change the video mode of this canvas. This method has the side effect of setting the $pref::Video::mode to the new values.\n\n"
               "\param width The screen width to set.\n"
               "\param height The screen height to set.\n"
               "\param fullscreen Specify true to run fullscreen or false to run in a window\n"
               "\param bitDepth [optional] The desired bit-depth. Defaults to the current setting. This parameter is ignored if you are running in a window.\n"
               "\param refreshRate [optional] The desired refresh rate. Defaults to the current setting. This parameter is ignored if you are running in a window"
			   "\param antialiasLevel [optional] The level of anti-aliasing to apply 0 = none"
			   "\param border [optional] window border style, 0 = none")
{
   if (!object->getPlatformWindow())
      return;
...

and add the next at the end of the method:

...

   if ((argc > 8) && (dStrlen(argv[8]) > 0))
   {
		bool border = dAtoi(argv[8])>0;
	   object->getPlatformWindow()->setVideoMode(vm, border);
   }
   else
   	object->getPlatformWindow()->setVideoMode(vm);

   // Store the new mode into a pref.
   Con::setVariable( "$pref::Video::mode", vm.toString() );
}

Hope it helps!
#3
01/07/2015 (10:49 am)
Awesome thanks for the help. I tried your changes Francisco, but for some reason in the latest Torque3D build on GitHub it didn't work. Maybe something was missed. I am now checking out The Virtual Reef code and some of it appears to be sorta the same with some extra stuff. Gonna try merging over the relevant stuff and see if it works.

I'll post here again after I do and let you know how it worked. They have some really cool touch support additions as well. Would love to see this added to the main torque build.
#4
01/08/2015 (2:08 am)
Sorry Nathan, there are several misses.

I have a branch in my repo with the working mods in a single commit:
https://github.com/pacomont/Torque3D/commit/8da11ac46bf6613562f674ad1e2a7572488faae5

BTW, is Virtual Reef code available? May I have a look? :-)

Edit: Ok, I see the link in Nathan Martin post...