Fullscreen on second monitor?

I have a simple question which I surprisingly cannot find an answer for anywhere:

How do I make my app fullscreen on the second monitor on windows? I have a projector connected to my computer and want to make it display my of app fullscreen on it.

OF0.11 btw

Hey welcome!

Try changing the main.cpp of your app to:

#include "ofMain.h"
#include "ofApp.h"
#include "ofAppGLFWWindow.h"

//========================================================================
int main( ){

	//tweak window settings
	ofGLFWWindowSettings settings;
    settings.setSize(1024, 768);
	settings.monitor = 1; //set it to use the second monitor
	//settings.setPosition(glm::vec2(1920,0)); //if the above doesn't work try this line instead
	settings.windowMode = OF_FULLSCREEN;
	
	//make the window
	auto mainWindow = ofCreateWindow(settings);

	//run the app 
	shared_ptr<ofApp> mainApp(new ofApp);

	ofRunApp(mainWindow, mainApp);
	ofRunMainLoop();
}

Hope that helps!
Theo

Hi theo, sorry for the slow reply, just coming back to this project now.

I tried that and different combinations of setPosition, monitor settings etc but nothing works?

I did manage to get the window fullscreen on the projector using this code, but it still has the taskbar at the bottom. If I set the taskbar to autohide then there is still a grey line…
this is the main.cpp

ofSetupOpenGL(1920,1080,OF_WINDOW);
ofSetWindowPosition(1920,0);
ofRunApp(ofApp());

I’ve been using this piece of code to open multiple windows fullscreen in macOs and Linux


shared_ptr<ofAppBaseWindow> newWindow;
vector <shared_ptr<ofAppBaseWindow> > allWindows;

#include "GLFW/glfw3.h"

//========================================================================
int main( ){
#ifndef WINDOWWIDTH
#define WINDOWWIDTH 1420
#endif

#ifndef WINDOWHEIGHT
#define WINDOWHEIGHT 840
#endif

	ofGLFWWindowSettings settings;
	settings.resizable = true;
	settings.setSize(WINDOWWIDTH, WINDOWHEIGHT);
	settings.windowMode = OF_WINDOW;
	//settings.numSamples = 8;
	//settings.setPosition(ofVec2f(80,80));
	//settings.setGLVersion(3, 2);

	auto guiWindow = ofCreateWindow(settings);
	auto mainApp = make_shared<ofApp>();
	int monitorCount;
	GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);

	cout << glfwGetVersionString() << endl;
	cout << "Screens Found: " << monitorCount << endl;
	
	for (int a=0; a<monitorCount; a++) {
		string output;
		output += "display # " + ofToString(a) + " : " + glfwGetMonitorName(monitors[a]) + "\r";

		float scaleX, scaleY;
		glfwGetMonitorContentScale(monitors[a], &scaleX, &scaleY); // We take the second monitor
		output += "contentscale : " + ofToString(scaleX) + " x " + ofToString(scaleY) + "\r";

//		glViewport(0, 0, width, height);

		const GLFWvidmode * desktopMode = glfwGetVideoMode(monitors[a]);
		glm::vec2 size = glm::vec2(desktopMode->width, desktopMode->height);
		output += "size: " + ofToString(size.x) + " x " + ofToString(size.y) + "\r";

		// not primary display, second, third
		if (a > 0) {
			settings.setSize (size.x, size.y);

			int posx; int posy;
			glfwGetMonitorPos(monitors[a], &posx, &posy);
			output += "position: " + ofToString(posx) + " x " + ofToString(posy);
			settings.setPosition(glm::vec2(posx, posy));

			settings.windowMode = OF_FULLSCREEN;
//			settings.resizable = false;=-
			settings.shareContextWith = guiWindow;
			newWindow = ofCreateWindow(settings);

			if (a==1) {
				ofAddListener(newWindow->events().draw, mainApp.get(), &ofApp::drawSecondWindow1);
			}
#ifdef MULTIPLE
			else if (a==2) {
				ofAddListener(newWindow->events().draw, mainApp.get(), &ofApp::drawSecondWindow2);
			}
			else if (a==3) {
				ofAddListener(newWindow->events().draw, mainApp.get(), &ofApp::drawSecondWindow3);
			}
			else if (a==4) {
				ofAddListener(newWindow->events().draw, mainApp.get(), &ofApp::drawSecondWindow4);
			}
#endif
			allWindows.emplace_back(newWindow);
		}
		ofxMicroUI::messageBox(output);
	}
	ofRunApp(guiWindow, mainApp);
	ofRunMainLoop();
}
2 Likes