Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Setting the monitor doesn't appear to work

$
0
0

@Godwhacker wrote:

Hi,

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.setPosition(ofVec2f(300,0));
settings.resizable = true;
settings.monitor = 0; // Specify monitor one
  
shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);

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

shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings);
guiWindow->setVerticalSync(false);

shared_ptr<ofApp> mainApp(new ofApp);
mainApp->setupGui();
ofAddListener(guiWindow->events().draw,mainApp.get(),&ofApp::drawGui);

ofRunApp(mainWindow, mainApp);
ofRunMainLoop();

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

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles