Dual Monitor Full-screen


#1

I have an of app running on a mac and I need to get it to be full screen across two monitors.

I can get it to go fullscreen on a single monitor with ofToggleFullscreen() but that leaves my second display showing the desktop. I also have tried my hand with ofxFenster to no avail (apparently the xcode examples are no longer supported in 8.0?). I also can’t get the ofxFenster code blocks projects to open without crashing code blocks instantly.

Are there alternatives? Should ofToggleFullScreen() do the trick for me? Should I be looking somewhere for a better/updated/working version of ofxFenster?


Multi-monitors causes blank display
#2

On OS X and OF 0.08, you can do this in main.cpp

  
  
#include "testApp.h"  
#include "ofAppGLFWWindow.h"  
  
int main(){  
	ofAppGLFWWindow win;  
	//win.setNumSamples(8);  
	win.setMultiDisplayFullscreen(true); //this makes the fullscreen window span across all your monitors  
  
	ofSetupOpenGL(&win, 800,500, OF_FULLSCREEN);  
	ofRunApp(new testApp());  
}  
  


#3

not sure if this works on the newest osx 10.9


#4

it works if you disable the silly screen management Mavericks (OSX 10.9) comes with by default;

Go to system preferences >> mission control >> and set “Displays have separate Spaces” to false.
Log out and Log in again, and it will work.


multiMonitorFullscreen not working on MacOSX
#5

thanks for the tip.


#6

Oh thank you so much!!! This has been an on-going nightmare!


#7

Thanks for the tip - I needed this too!

I don’t mean to hijack this thread, but related question - what if one wanted to control which monitor the full screen view was on? By default it opens in the same window as the one with the OSX dock. Is it possible to force it to open on the other one (i.e. projector) and not the laptop screen?


#8

Looking for that too. Used to be possible in older versions of OF (at least 006x), simply be first setting the resolution of the second screen and then replacing the window position, like this:

  
ofAppGlutWindow window;  
	 ofSetupOpenGL(&window, 1920, 1080, OF_FULLSCREEN);			// <-------- setup the GL context	  
	 ofSetWindowPosition(0, -1080); 	//	for positioning to second screen:	  
	 ofRunApp( new testApp());  

But this doesn’t work anymore in 0.8… Is there a new way to do this properly?


#9

Ah, going fullscreen in the second window does still work if you start in window mode, and then move your window to the second screen before toggling with ofToggleFullscreen().

  
  
void testApp::keyPressed(int key){  
	  
	if (key == 'f')  
	ofToggleFullscreen();  
}  


#10

here’s how I automated this. Works on Mac with displays in any arrangement. Even works with Mission Control’s “displays have separate spaces” enabled. (This is for fullscreen on a 2nd monitor, not spanned across monitors). My main.cpp:

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

//========================================================================
int main( ){
    
    // Get screen widths and heights from Quartz Services
    // See https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/index.html
    
    CGDisplayCount displayCount;
    CGDirectDisplayID displays[32];
    
    // Grab the active displays
    CGGetActiveDisplayList(32, displays, &displayCount);
    int numDisplays= displayCount;
    
    // If two displays present, use the 2nd one. If one, use the first.
    int whichDisplay= numDisplays-1;
    
    int displayHeight= CGDisplayPixelsHigh ( displays[whichDisplay] );
    int displayWidth= CGDisplayPixelsWide ( displays[whichDisplay] );
    
    /* /////////////// this is a bit slow to do  /////////////
    // move 2nd display to right of primary display and align display tops
    if(numDisplays > 0){
        CGDisplayConfigRef displayConfig;
        CGBeginDisplayConfiguration ( &displayConfig );
        CGConfigureDisplayOrigin ( displayConfig, displays[1], CGDisplayPixelsWide(displays[0]), 0 );
        CGCompleteDisplayConfiguration ( displayConfig, kCGConfigureForAppOnly );
    }
    */
    //* //////// instead let's just moving our window to wherever our display is living:
    
    CGRect displayBounds= CGDisplayBounds ( displays[whichDisplay] );
    
    ofSetupOpenGL(displayWidth, displayHeight, OF_FULLSCREEN);            // <-------- setup the GL context
    // that OF_FULLSCREEN makes the window as big as the primary display, but we want it to be as big as whichever we're using
    ofSetWindowShape(displayWidth, displayHeight);
    // move onto our display.
    ofSetWindowPosition(displayBounds.origin.x, displayBounds.origin.y);
    
    // print display info.
    cout<<numDisplays<<" display(s) detected."<<endl<<"Using display "<<whichDisplay<<" ("<<displayWidth<<"x"<<displayHeight<<")."<<endl;
    
    // this kicks off the running of my app
    // can be OF_WINDOW or OF_FULLSCREEN
    // pass in width and height too:

    ofRunApp(new ofApp());
}

#11

On OSX, you can use ofxNSWindower. Create 2 (or more) instances and add position like this

ofxNSWindower::instance()->addWindow(new App(), “main”);
ofxNSWindower::instance()->getWindowPtr(“main”)->setWindowShape(760,560);
ofxNSWindower::instance()->getWindowPtr(“main”)->setWindowPosition(400,700);

ofxNSWindower::instance()->addWindow(new renderApp(), “RENDER”, NSBorderlessWindowMask, 60);
ofxNSWindower::instance()->getWindowPtr(“RENDER”)->setWindowShape(1024,768);
ofxNSWindower::instance()->getWindowPtr(“RENDER”)->setWindowPosition(1440,900);

use gregorywitt code to find screen proprieties :wink:

This allow you to create multi windows app, and each window can be one fullscreen.


#12

Hi, I came across this forum while searching for a solution on google.
I need to span and set to fullscreen a mac app (ableton) across my 2 monitors on mavericks.

Is it possible?

I don’t know a thing about programming or what you guys are talking about here :disappointed: but i’ll really appreciate it if someone takes the time to explain how to do it.

Thanks :pray:


#13

I’m using your solution for a program. One issue I have is it is only fullscreen when app is focused.
If I switch to another application I get an OS X statusbar on the top. Do you have this issue too?