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?
#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());
}
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?
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?
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();
}
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());
}
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 but i’ll really appreciate it if someone takes the time to explain how to do it.
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?