Setting the monitor doesn't appear to work


New to OpenFrameworks, and trying to port something I started in C# and OpenTK but need a bit more juice for.

I’m attempting to set the monitor my app works on. I opened the “multiWindowOneApp” example project that comes with the code, and edited it as follows:

ofGLFWWindowSettings settings;
settings.setSize(600, 600);
settings.resizable = true;
settings.monitor = 0; // Specify monitor one
shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);

settings.setSize(300, 300);
settings.resizable = false;
settings.monitor = 1; // Specify monitor two

shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings);

shared_ptr<ofApp> mainApp(new ofApp);

ofRunApp(mainWindow, mainApp);

Naively, I expected this to keep the first window on monitor one, and move the second to monitor two. But it doesn’t. In fact, none of the examples that I’ve looked at that use the ofGLFWWindowSettings class seem to allow the monitor to be specified.

Things I have tried:

Calling ofAppGLFWWindow::listMonitors(); correctly logs all the attached monitors- they’re definitely there.

Adding settings.windowMode = OF_FULLSCREEN; makes it full screen, but again only on the primary monitor.

Creating a second ofGLFWWindowSettings object, specifying a different monitor, and creating the second window also fails.

Removing the calls to setSize and setPosition doesn’t work.

Moving Visual Studio itself to the second monitor and running from there opens the app on the primary monitor, so it’s not taking hints from that either.

Can anyone help with this?

I’m on Windows 10, using Visual Studio 2017

Thanks in advance

OK, I think I’ve solved it- if I set the monitor I want to use, with a width and height, and set the settings.windowMode to ofWindowMode::OF_GAME_MODE rather than ofWindowMode::OF_FULL_SCREEN it shifts to the correct monitor.

It’s also possible (on Windows at least) to simply set settings.decorated to false and shift the window to the position you want it with it’s x and y coordinates. So, if you’ve got two 1920 x 1080 monitors next to each other, and your primary monitor is on the left, do settings.setPosition(glm::vec2(1920.f, 0 )); to move it to the top left corner of the second screen.

Next question: is this documented anywhere? Is there somewhere I should look for this kind of thing?

Another question: are there any ‘gotchas’ here with moving between the windowing systems on MacOS and Windows? I’d like to get this running on both.

Thanks in advance