Multiple windows sharing context and occasional low framerate


#1

Hi OFer’s !

I’ve been trying to make an app that have 2 screens. Basically 1 for UI and previews and the 2nd screen as “fullscreen output”.

I’ve followed the examples/events/multiWindowOneAppExample so that is sharing contexts, so I end up with a main.cpp

ofGLFWWindowSettings settings;

// MAIN WINDOW
settings.width = 1280;
settings.height = 1024;
settings.setPosition(ofVec2f(320,0));
settings.setGLVersion(4,1);
settings.resizable = true;
shared_ptr mainWindow = ofCreateWindow(settings);

// SECOND WINDOW
settings.width = 320;
settings.height = 240;
settings.setPosition(ofVec2f(0,0));
settings.resizable = true;
//settings.setGLVersion(4,1);
// uncomment next line to share main’s OpenGL resources with gui
settings.shareContextWith = mainWindow;
shared_ptr guiWindow = ofCreateWindow(settings);

mainWindow->setVerticalSync(false);
guiWindow->setVerticalSync(false);

shared_ptr mainApp(new ofApp);
ofAddListener(guiWindow->events().draw,mainApp.get(),&ofApp::drawProgramWindow);

ofRunApp(mainWindow, mainApp);
ofRunMainLoop();

What is happening is that sometime when I run the app the framerate is about 15 fps … and sometimes it’s 60 fps.

I thought it had some relation with the share_context issue, as with just one window it always runs smooth at 60 fps. But even when having no code on the ofApp::drawProgramWindow, a high percentage of the time that I runn the app it runs at 15 fps … and the other porcentage it runs at 60 fps …

Is there any problem on sharing contexts with different GL Versions ? I would love to have #version 410 in the mainWindow and the second window I don’t need it at all as I’m just willing to draw a texture got by reference …

Any ideas ? Thanks !


#2

@eloi did you ever solve this as we’re seeing something similar although not exactly the same. ofGetFramerate() always reports the same but we see a stuttering every now and then


#3

hi jrs … Nope … I never got to solve that … I think it was an issue with GLSL Shaders and sharing GL context. I forgot about it, I’ll try to reproduce it again and see if I can put more info in this thread …

What configuration of multiscreen did you had ? Are you sharing context ?

e*


#4

We’ve got two 1080ti’s on windows 10 and have 2 windows with a shared context and out aim is movie playback at 9600x1080. We’re seeing the same thing though in a simple test case with a single 1070 with two windows on two displays and just moving an image around. It seems to run fine for 3-4sec and then drop a frame or two but if we onlt have a single window its fine.


#5

Back to it. Still having this issue .

It’s quite confusing … I’m drawing a video texture on the second window with shared context … and sometimes goes to 60 fps as expected … and some other very slowly, like 15 to 9 fps …

I’ve checked again today and most of the times I can go at 60 fps without much load as expected … and some other runs just goes to 14 fps, without changing any parameter or nothing else then recompiling … weeeird ?

Did you find out anything around this issue ?

e*