Multiple windows alternatives

I’m now working in projects involving multiple fullscreen windows, two or three 4k outputs other than the GUI.
I’ll be only sharing one texture in each window, so I think OF builtin functionality is too much. I see framerates dropping considerably while using them.
Do you use any alternative for macOS? I’m starting to look at old addons for multiple windows.
Thank you!

HI @dimitre
Just wondering, why is it too much?
Do you need it to be multiple screens? why having one large fullscreen window that spans over all outputs?

Great, I thought of making one giant screen for the 3 displays, strangely when I try to open it fullscreen it ends on the first monitor where the UI is. I’ll try to test with more displays connected to see if it works.
Any disadvantage? maybe vertical sync not locked in different displays?

on the OS side, check your Settings / Desktop / Mission Control and make sure “displays use separate spaces” is not enabled; that tends to have funny side effects.

on the OF side at one point I “decided” that spanning monitors with ofSetFullScreen() did not render as fast as a large, undecorated window. this was based on semi-systematic testing circa 2019 on the macOS+OF of the moment; maybe there were other parameters (although the machines were kept pretty lean) but all this to say it might not be relevant anymore… but it’s still more practical to manage a single app than multiple apps.

int main( ){
    ofGLFWWindowSettings settings;
    settings.decorated=false;
    ofCreateWindow(settings);
    ofRunApp(new ofApp());
}

then

void ofApp::setup(){
    ofSetWindowShape(7660, 2160);
    ofSetWindowPosition(0,0);
}

vertical sync is a good question, it also connects to GPU question – where does the rendering occur? as far as I could figure out, it occurs in the context of the monitor that has the menu bar assigned in the “displays” settings. so whatever GPU is under there generates the whole canvas, and it gets mapped out (maybe also it’s the monitor where 0,0 is – in my case it was probably the same as the menubar). I presume a frame or so of latency (but no tearing). i have also spanned dissimilar monitor resolutions; as long as the whole window covers everything it seems to work without penalty. but again this kind of stuff is pretty context-specific…

(and this presumes the multiple screens do not gain by being truly multithreaded (multiprocess) as the update/draw GL thread will render the whole canvas. depends on what’s going on.)

3 Likes

Thanks! I think it will work well, if I use the adjusted screen for only the 3 4ks and not the UI window. I suppose I can have problems while switching apps (command + tab) if I was using one entire window, I’ll be testing.

Hi @dimitre The trick is what @burton mentions about “displays use separate spaces” being unselected.

@burton thanks for the tips!

The ofGLFWWindowSettings class has a parameter to set the display id of that window. Might be useful.

I would guess that having a single big window i easier on the CPU because there is less GL context switching, etc.

Thanks @roymacdonald and @burton the solution works, but there is one more step to make it work. I’ll be sharing here if anybody else needs a similar setup.
And yes I always disable separate spaces, first thing in a new computer.
If I open let’s say a new window with 11520 x 2160 (3 4k side by side) in the position of the second monitor, it appears in always in the wrong screen.
The only way it worked here was creating a new window with a smaller size, lets say 4k, and then in another frame asking it to be resized to final resolution and positioned in the right offset.

		allWindows.back()->setWindowPosition(pos.x, pos.y);
		allWindows.back()->setWindowShape(3840*3, 2160);

I’m not sure if this is an issue of ofAppGLFWWindow ou GLFW itself, I’ll test later

2 Likes

Just to share more info in the case others have the same need.
I’ll be using the suggested approach, but with one regular window for GUI, and a second window in fullscreen spanning all 3 4k screens.
I’ve noticed the monitor indices on GLFW doesn’t reflect the order set on system preferences, maybe it is something else, like the first plugged screen to the last.
So I’m getting the minimum x position of any monitor which is not index 0, and positioning the window there.