underdoeg/ofxFenster — Issue #32: spanning multiple monitors in OS X
Author: heisters
Created: 2011-11-16 19:43:35+00:00
State: open

I can't get ofxFenster displaying fullscreen across two monitors and two graphics cards on OS X. I've tried a few approaches:

1. use OF_FULLSCREEN: the window is correctly shown filling the active display, but doesn't appear at all on the secondary display, even though the resolution should be high enough to span both.
2. use OF_WINDOW: the window is correctly shown spanning both displays, but is scaled to allow room for the dock and the menubar, even through I've specified a high enough resolution to cover both.
3. both of the above approaches using one video card: the window dimensions are the same as with two video cards, but the window contents are black, occasionally flashing the content.

I have extended the recommended main() call in order to detect the number of displays and automatically initialize the first window with the correct dimensions. This seemed preferable to my app doing this work, creating a second window, and killing the default window. Here's what that looks like:

```cpp
#include "ofMain.h"
#include "videoWall.h"
#include "ofxFensterManager.h"
#include "ofAppGlutWindow.h"

//========================================================================
int main( ){
ofxFensterManagerPtr fenster = ofxFensterManager::get();

ofxDisplayList displays = ofxDisplayManager::get()->getDisplays();
cout << "Found " << ofToString(displays.size()) << " displays" << endl;

int minX = 0, minY = 0, maxX = 0, maxY = 0;
ofxDisplay * minDisplay;

ofxDisplayList::iterator dit;
for(dit = displays.begin(); dit < displays.end(); dit++){
ofxDisplay * display = *dit;
minX = min(minX, display->x);
minY = min(minY, display->y);
maxX = max(maxX, display->width + display->x);
maxY = max(maxY, display->height + display->y);
if(minX == display->x && minY == display->y){
minDisplay = display;
}
}

cout << "Setting up display: " << maxX - minX << "x" << maxY - minY << endl;

fenster->setActiveDisplay(minDisplay);
// ofSetupOpenGL(fenster, maxX - minX, maxY - minY, OF_FULLSCREEN);
ofSetupOpenGL(fenster, maxX - minX, maxY - minY, OF_WINDOW);
ofxFenster * win = fenster->getActiveWindow();
win->setBorder(false);

ofRunFensterApp(new videoWall());
}
```
Is this even the right way to approach it? I've read about using multiple rendering contexts, which is what I think the multiple graphics cards example does, but wasn't entirely clear on how to display different portions of the same app in each window. This seemed like a quick-and-dirty approach albeit possibly at the cost of performance.