I have been searching for this everywhere and never found the answer.

I am developing a feature to allow the user to select which monitor to run the game.

I have two monitors, primary and secondary. I tried to use "GraphicsAdapter.Adapters" but it always retrieves only 1 monitor (the one I am running the Visual Studio which is the default one).

Is this a bug? How can I retrieve all the monitors available?


MONOGAME 3.6 OPENGL (cross platform) Visual Studio 2015 Windows 10 Pro 64bits


If we look at the code for the 3.6 release:

There are three files containing GraphicsAdapter source code. It looks like GraphicsAdapter.Legacy.cs is used if you are using the Windows/OpenGL build of MonoGame.

In this version of the code, the Adapters property performs lazy-initialization of the underlying _adapters array. It has preprocessor blocks to build the array differently based on which platform is being built for. Since you're using Windows, that translates to a call to this line:

_adapters = new ReadOnlyCollection<GraphicsAdapter>(new[] { new GraphicsAdapter() });

The property then simply returns _adapters.

So yes, for OpenGL builds on Windows, GraphicsAdapter.Adapters will only ever return a single item. MonoGame does not appear to implement the functionality necessary to expose multiple-monitor support for OpenGL on Windows, at least not in the fashion you're looking for.

| improve this answer | |
  • \$\begingroup\$ thank you for this useful information, Josh. Now I know where to head to. I dont have enough reputation to vote up yet but the vote was recorded! You will get it as soon as my rep increases it \$\endgroup\$ – Leonardo Cunha May 4 '17 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.