How to share objects among windows?

Hi!
I currently have the need to share some objects and variables among two windows.
For example, in one window I have a GUI on top of a webcam image, and I need to access the parameters from this GUI in the other window.
I saw some examples using something like that:

ofGLWindowSettings settings;
// ...
settings.shareContextWith = mainWindow;

But it seems that shareContextWith doesn’t exist anymore… (OF 0.9.3) :pensive:
Somebody knows a good way around?

Namastè

Hello @VVZen, maybe in this thread there is the answer to your question

Thanks @edapx.
But the solution proposed by @arturo doesn’t seems viable, since I cannot find the member shareContextWith (as Xcode reports)! Maybe I’m doing something wrong…

settings.shareContextWith = mainWindow; // No shareContextWith member!
shared_ptr<ofAppBaseWindow> secondWindow = ofCreateWindow(settings);

Hello @VVZen,

it does not exist because you have probably declared your settings variable as a ofGLWindowSettings type. Declaring it as a ofGLFWWindowSettings solved my problem, like this:

ofGLFWWindowSettings settings;
settings.shareContextWith = mainWindow;
auto sideWindow = ofCreateWindow(settings);
1 Like