Components that derive from OpenGLRenderer load slowly when first added

We’re having an issue where on first load, components are displayed in a staggered order over the course of something like 500-1000ms. There are probably 15 components, and the display lag seems to go away if they do not derive from OpenGLRenderer.

Is this expected? Is there anything we can do to speed up the initial adding of components with OpenGLRenderers?

OpenGLRenderer is just a pure virtual base class - it doesn’t actually do anything at all.

Certainly there’ll be a bit of startup time involved when you create an openGL context because the OS/driver will need to set things up, but you typically only want to do that once in your app. Maybe you’re just closing/re-opening contexts more often than you should?

We haven’t been able to find a workable solution for sharing an openGL context between all our components in Juce, so at the moment, each component has its own OpenGLContext. I assume that’s what’s causing the slower sequential load when the UI is first displayed.

From what I can tell by profiling, it looks like most of the time is spent waiting to acquire a lock on the message thread in juce::OpenGLContext::CachedImage::runJob().

Bump. Anything else we could try to workaround this?

I think Fabian’s been working on some code to let multiple renderers share a context…


Great news! Thank you

1 Like

any update to this?