How to optimize OF output across multiple graphical cards?

Hi All,

I’m currently working on a project requires 18 monitors, so I built a Win10 pc with 3 graphical cards, and used Eyefinity to group all displays on the same card into a single virtual monitor. And my goal is to output my OF applications across the 3 virtual monitors.

My sketch runs OK on one monitor with 60 fps. But when I expand to 3 monitors, I only get 5 fps. Then I tried to create an empty application that only set up fullscreen and draw a few lines, but I still only get about 10~15 fps.

I even tried to use the multiWindow example. Two windows drop framerate to 25fps and three windows drop framerate to 8fps.

Is there a suggestion on how to improve it? Any kind of help is appreciated.


you have to be sure that only one window has vertical sync enabled otherwise the app might try to sync to the frame more than once per frame so you get really low framerates

1 Like

Hi Arturo,

Thanks for your help. I tried to turn off Vsync, it helps a lot but only about 20%~50% increase.

Then I tried the multiWindowExample, used code like this

   settings.setSize(1920*3, 1080*2);
	settings.resizable = false;
	settings.monitor = 1;
	settings.windowMode = (ofWindowMode)OF_FULLSCREEN;
	shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);

   settings.setSize(1920*3, 1080*2);
	//settings.resizable = false;
	settings.monitor = 2;
	settings.windowMode = (ofWindowMode)OF_FULLSCREEN;
	shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings);

It works as expected at 7fps. With both context on Primary graphical card.

I found in line 231 of “ofAppGLFWWindow.cpp”, there is

windowP = glfwCreateWindow(settings.getWidth(), settings.getHeight(), settings.title.c_str(), nullptr, sharedContext);

if I change it to

int count;
GLFWmonitor** monitors = glfwGetMonitors(&count);
windowP = glfwCreateWindow(settings.getWidth(), settings.getHeight(), settings.title.c_str(), monitors[settings.monitor], sharedContext);

Now the context is on separate cards. The framerate boost to 900fps. The only problem is, once a window lose focus, it dissappears. And I can only see one window at a time.

Am I doing it correctly? Is there a way to show all windows at the same time?

Answering my own question:




void ofAppGLFWWindow::setup(const ofGLFWWindowSettings & _settings){

solved the issue. Now the app is running on 60fps with primary GPU idle.


1 Like

specifying the monitor is what happens when you use OF_GAME_MODE and specify a monitor in the window settings so that should have the same effect without modying the code i think.

didn’t knew about auto iconify could you open an issue on github? it seems when a full screen window losses focus it iconifies by default which is probably not what we want so we should call this when using game mode

Yes, now I can confirm use OF_GAME_MODE and specify a monitor has the same effect without modifying the code.

glfwWindowHint(GLFW_AUTO_ICONFIY, GLFW_FALSE); may still be needed.