Deadlock when using multiple OpenGLRenderer components as children of a non openGL component

Thank you for your advice.
It was convenient to have an OpenGLContext per area that I wanted to render OpenGL too, but if that results in synchronization issues between the OpenGL threads then I don’t think it’d be worth the possible issues that may randomly pop up (like this one I’m seeing now).

I think I understand what you’re suggesting. Only having one OpenGLContext means that I’ll have to have a component that at minimum is a union of all the areas I want to render OpenGL to. It will also have to be an OpenGLRenderer too. I have to make sure that I don’t call setComponentPaintingEnabled (false) for this component since it will need to be responsible for at least setting a background color in its paint call.
Then I’ll have to create child components that are OpenGLRenderers. These child components will need to call setOpaque(true) in order to prevent it’s parent’s paint function from drawing over it (this is needed because the OpenGL rendering is done first and then the paint call is made after).
The parent component will have to pass along the OpenGLRenderer calls to its children.
The last piece that I’ll need to consider is that the child component needs to know where it is located within the OpenGLContext. It will have to offset it’s OpenGL rendering to make sure it goes to the correct location within the OpenGLContext.

Does that sound about right? Am I missing or misunderstanding anything?

I’ll give this a try and see how it works.
Thanks again.

1 Like