Fullscreen dual screen

well I guess I will set the DualHead as primary screen, or I will add some steps to the startup procedure :slight_smile: [launch the app, drag it over to the secondary screen - dualHead - press ‘f’ to pass to the fullscreen mode]


hey theo -

this is really useful … especially for performances with GUIs!
is there any way to change those settings directly using glut functions?
the only mention of this feature i found on google are posts of yours.


I’ve tried changing the gl preferences to span across desktops. It works, but i get artifacts. there are two white horizontal lines that go across the top of the screen on both monitors. anyone else getting this? have a solution?

[quote author=“smallfly”]well I guess I will set the DualHead as primary screen, or I will add some steps to the startup procedure :stuck_out_tongue:

Here’s how I got dual fullscreen working on Windows (nVidia card set to Dual View, 800x600 at each display):

ofSetupOpenGL(1600,600, OF_WINDOW);  

Yeah , it runs !

Using windows an setup screen , the second screen available with the same resolution, and moving the window to the second screen.TT

ofSetupOpenGL(1024,768, OF_WINDOW);   


…and last of all, for Linux this worked for me:

ofSetupOpenGL(&window, 2880,900, OF_GAME_MODE);			  

No need to call ofSetWindowPosition().
I’ve got an Nvidia card, so I enabled TwinView, set both monitors to be the same resolution then set an Absolute position for both with the second monitor having a positive offset the size of the width of the screen.

[quote author=“AlexandreRangel”]Here’s how I got dual fullscreen working on Windows (nVidia card set to Dual View, 800x600 at each display):

ofSetupOpenGL(1600,600, OF_WINDOW);  


Hi alexander,
I am looking for a graphics card for an installation with two projectors (800x600 each).
it will be only video (no 3D) and I am on low budget.
which nvidia did you use ?
was the performance ok ?


Just if anyone using Mac OS X, make sure you turn off ‘Mirroring’ in the Display settings of System Preferences…

As a side note, the extended desktop method only works when the primary desktop is the left screen. When your primary desktop is the right screen, it simply fullscreens on the left screen.

has anybody had any progress with having fullscreen on second monitor + window or fullscreen on the first?

one issue is that the resolution of my second screen depends on what projector setup i’m using, and rarely relates at all to my first screen resolution.

at the moment i only need to output 2 textures to the second screen, and they dont necessarily need to come up on the first display at all

maybe could make a very light ofx which handles all this stuff (positioning renderers fullscreen on different heads, making multiple GLUT windows)

roikr, OF performance is so incredible, I got this working on any nVidia card made on the last 4 years or so.
My main performance machine is a MacBook with a Nvidia GeForce 9400M.
I think it’s safe for you to go with anything stronger than an onboard Intel chip.

elliotwoods, my app runs fine fullscreen on both heads, 1024x768 on the first one and 640x480, 800x600 or 1024x768 on the second one.
I could even drive three 1024x768 outputs (plus main display) with a Matrox TripleHead adapter.

how to get two seperate renderports with good performance and shared assets?
or are you setting up two separate OF apps?

To use 2 monitors/beamers at once (each at a resolution of 1024x768), this is what you need to do (Windows only, I do not have a Mac so I can’t give advice about that):

(1) If running on a videocard that supports SPAN MODE, you can simply use:

ofSetupOpenGL(&window, 2048, 768, OF_FULLSCREEN);  

In the NVidia control panel, horizontal span mode can be found at the “Set up multiple displays” tab. The setting is called “As one large horizontal desktop”.

On ATI it is a much more hidden feature that I sometimes got working, but only when using DVI cables and not the standard analog VGA cables. More often than not, however, it took me hours trying to configure the displays before giving up.

(2) When using a Matrox DualHead2Go, you can do the same. Windows will only see 1 very wide monitor with a resolution of 2048x768, which is basically the same as span mode.

(3) If span mode is not available, I can confirm the solution in this thread works like a charm:

ofSetupOpenGL(&window, 2048, 768, OF_WINDOW);  
ofSetWindowPosition(0, 0);  

This will properly run your app “fullscreen” on 2 monitors. You can even easily switch between windowed and full screen mode with this code in testApp.cpp:

void testApp::keyPressed(int key){  
	int screenWidth = ofGetScreenWidth();  
	int screenHeight = ofGetScreenHeight();  
		case OF_KEY_PAGE_UP:  
			// set window to full screen dual view  
			if( ofGetWindowMode() == OF_WINDOW ){  
				ofSetWindowShape(2 * screenWidth, screenHeight);  
				ofSetWindowPosition(0, 0);  
		case OF_KEY_PAGE_DOWN:  
			// set window to windowed mode (choose an appropriate window size)  
			if( ofGetWindowMode() == OF_WINDOW ){  
				ofSetWindowShape(1200, 450);  
				ofSetWindowPosition((screenWidth - 1200)/2, (screenHeight - 450)/2);  

I hope this answers a few of the questions here. And thanks to the genius who found out you don’t need span mode at all… could have saved me hours of frustration and many a euro had I discovered this thread earlier :slight_smile:

To keep content from appearing on the incorrect monitor
Use OpenGL’s scissor functionality before drawing your content:

glScissor(x, y, w, h);  
... do your drawing here ...  

This will make sure nothing is drawn outside your scissor rectangle. Note: the rectangle is specified in window coordinates and is insensitive to any translation, rotation or scaling done prior to calling the “glScissor” function. In other words: you can’t specify a rotated scissor rectangle, let alone a triangle or trapezium shape.

But what if my content is not rectangular?
In that case I would recommend rendering to an FBO texture (browse these forums for more info). But ehm, this has little to do with multiple monitor setups.

Is there a performance difference between running fullscreen and windowed?
Yup, a substantial one in my case (Intel Quad Core CPU, NVIDIA Quadro FX 550). Using a fullscreen window clearly has a lower framerate than running the same application as OF_FULLSCREEN in span mode. There is also a chance the Windows taskbar is visible on top of your fullscreen content. Meh.

possible to run as two seperate renderports?

ideally I want to be able to render to two seperate contexts within the same application. it’s something that i’m familiar with in vvvv and performs quite well (generally can mix and match whatever monitor/triplehead setup and keep your 60fps). but vvvv uses directx, so there could be a big difference there.

i presume in oF you’d need to set up two threads, each running an ofRunApp
then have some static classes to perform communications between the two. is there anything else you’d need to do? since OpenGL isn’t very object oriented, it seems like there could also be issues with OpenGL knowing which bit of the app renders to which viewport?

a more basic requirement is to run fullscreen on the second monitor (only 1 renderer, mainscreen for dev, second screen is render context going out on a projector). any ideas on that without using windowed mode?

back in the days of using MaxMSP I was having hell with these issues (ended up having about 20fps to run 2 projectors off one computer with mainscreen as interface). which worries me that it’s a general OpenGL issue… :frowning: ?

Ain’t there a way do enable it by code?

I’m on a mac but i can’t see the glut preferences. Is it removed?

yes we are not using glut anymore if you want to have fullscreen on several monitor now you have to do in main.cpp:

#include "ofAppGLFWWindow.h"

int main(){
    ofAppGLFWWindow window;
    ofRunApp(new testApp);

on osx, I’ve had luck hacking with the GLFW window directly to make it borderless and on on top of everything else – I’ve put some code here in a gist but can make a small sketch. Having low level access to the window is pretty helpful and I think it could be useful to get the full screen work well across multiple monitors, etc:


one quick note on the code above, you’ll need to force xcode to compile the .cpp files as objective-c++ if you want to mix objective c code in your .cpp file. you can do this in the sidebar:

and this at the top of your h file:

#include <Cocoa/Cocoa.h>
#include <Carbon/Carbon.h>

hope this helps,

1 Like