Multi Display Fullscreen 0.9.0 OSX

Is there an updated solution for running oF stretched across multiple displays – fullscreen – for 0.9.0?

Used to use:

"
OfAppGLFWWindow window;
window.setMultiScreenDisplayFullscreen(true);
ofSetupOpenGL(&window, 1920, 1080, OF_WINDOW);

"

in the main.cpp file.

This is no longer working and setMultiScreenDisplayFullscreen() is deprecated and doesn’t seem to be functioning.

Any updated solution for this?

Since 0.9 any settings for the window should be passed using the window settings classes:

ofGLFWWindowSettings settings;
settings.multiMonitorFullScreen = true
settings.windowMode = OF_FULLSCREEN;
ofCreateWindow(settings);
ofRunApp(new ofApp);
3 Likes

Amazing… WORKS!

Thanks for the fast response

Here is my solution. First, make sure that you are able to span multiple displays with a single window. Since OSX Maverics each display is considered a separate “space” and you can have one app window on one screen, no spanning. This can be disabled.

  1. Click on the  menu.
  2. Go to System Preferences.
  3. Mission Control.
  4. Uncheck “Displays have separate spaces”.
  5. Restart the computer.

Source: imore.com

Make sure that your additional displays are placed to the right from your main display. Use the following code in main.cpp to create a window without the title-bar.

	ofGLFWWindowSettings windowSettings;
	windowSettings.decorated = false;
	windowSettings.setPosition(ofVec2f(0, 0));
	windowSettings.width = 1920 * 2;
	windowSettings.height = 1080;
	
	ofAppGLFWWindow window;
	window.setup(windowSettings);

	ofSetupOpenGL(&window, 1800, 900, OF_WINDOW);
	ofRunApp(new ofApp());

This will span your window across two FullHD screens. If you have more screens connected and want the app window away from the main window, use the following code in ofApp::setup() to adjust positioning.

	int screenWidth = ofGetScreenWidth();
	int screenHeight = ofGetScreenHeight();
	int monitorCount;
	GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);
	
	if(monitorCount >= 3 || (screenWidth != 1920 || screenHeight != 1080)){
		int monitorCountUsedByWindow = monitorCount - 1; // All monitors, except the main one.
		int windowWidth = monitorCountUsedByWindow * 1920;
		int windowHeight = 1080;
		ofSetWindowPosition(screenWidth, 0);
		ofSetWindowShape(windowWidth, windowHeight);
	}

This will work if you have two or more FullHD monitors connected. If there is only one monitor connected, make sure that your main monitor has different resolution. But this is only one possible scenario. You can change it depending on your context.

1 Like

Just to follow up on this, saw it pop up not far down the forum list again…

I’ve been using the following block for most of my main.cpp files lately, adjusting as I need:

ofGLFWWindowSettings s;
s.setGLVersion(4, 1);
s.multiMonitorFullScreen = true;
s.windowMode = OF_FULLSCREEN;
ofCreateWindow(s);
ofRunApp(new ofApp());

My machine will run openGL 4.1, and since I do a bunch of shader stuff I need to make sure the GL version is set so the shaders will properly compile.