One OpenGLContext with multiple OpenGLRenderers?

Currently, I have two separate windows and I want them to have their own (independent, so they could have different update frequencies) rendering threads. So far so good. However, I also want them to share an OpenGLContext so that they can access each others resources, but I can’t get this to work. I’ve tried

 openGLContextB.setNativeSharedContext(openGLContextA.getRawContext());

but to no avail. At least, OpenGLContext::getRawContext() returns different values for both, but maybe there is a better way to test this?

Ideally, I would also like to initialize my OpenGLContext during my program startup (so before it starts drawing components). Is there a way I could solve these issues by somehow creating a NativeContext during startup?

A slightly elaborated explanation of what I’m doing: The primary renderer is creating real-time images on one screen, with this rendering currently being done in OpenCL (might switch to Vulkan/Metal in the future). The secondary renderer shows the GUI with the controls and should be able to display a small thumbnail of what is rendered by the primary renderer, hence I want access to the final displayed image of the primary renderer.

Let me know if you want some more information and thanks in advance!

1 Like

Does anyone have any input on this? It’s really starting to become an issue and I’d like to solve it.

At least, OpenGLContext::getRawContext() returns different values for both, but maybe there is a better way to test this?

I’m still experimenting myself, but on second thought this doesn’t look like the right way to test this. So what would be the best way to test if two contexts are actually “shared”?