Displaying on multiple monitors

Hi!

I am trying to show two streams on a 2-monitor setup such that each stream is visible in fullscreen on each screen.

However, OP only seems to use or register one of my screens. Can anyone help?

From main.cpp:

int main( ){
    
#ifdef OF_TARGET_OPENGLES
	ofGLESWindowSettings settings;
	settings.glesVersion=2;
#else
	ofGLWindowSettings settings;
	settings.setGLVersion(3,2);
#endif
	settings.setSize(3840, 1080);
	settings.windowMode = OF_FULLSCREEN;

	ofCreateWindow(settings);
    
	ofRunApp(new ofApp());   
}

When I call draw in ofApp.cpp:

void ofApp::draw()
{
      if (IS_RUNNING == 0)
      {
            ofClear(0, 0, 0, 255);
      }

      if (IS_RUNNING == 1)
      {
           thread0.lock();
           thread0.tex.draw(0, 0, thread0.camWidth, thread0.camHeight);
           thread0.unlock();
           thread1.lock();
           thread1.tex.draw(1920, 0, thread1.camWidth, thread1.camHeight);
           thread1.unlock();
      }
}

Hey I haven’t done this full disclosure. But, if I were trying to do what you describe, I’d do something along the lines of the multiWindowExample or the multiWindowOneApp example. I’d also try to change my video driver settings to use 2 screens. Then in the oF application (in main.cpp) I’d set the the position of one window to (0, 0), and set the position of the other to (0 + screen width, 0). I’d set both windows to the OF_FULLSCREEN type too.

If you look at these examples, make sure you look at the main.cpp file as most of the magic happens there, where the window settings are setup and the windows are created before an instance of ofApp is created and starts to run.

I’d try this out but I don’t have 2 monitors here to play with. But hopefully this approach will work well.

1 Like

Hi Tim,

Thank you, both things work!

I also found another way based on what you sent. It works for two monitors of width 3480 and height 2160, and then I work in one window only, with focus on that immediately.

int main( ){
    ofGLFWWindowSettings settings;

	settings.glVersionMajor = 3;
	settings.glVersionMinor = 2;	

	settings.setSize(3840*2, 2160);
	settings.setPosition(glm::vec2(0, 0));
	settings.windowMode = OF_FULLSCREEN;
	settings.multiMonitorFullScreen = true;

	ofCreateWindow(settings);
	ofRunApp(new ofApp());   
}

Cheers!

1 Like