Component::createComponentSnapshot() returns black image if OpenGL context attached.
- Painting a Component uses a cached image if available:
void Component::paintWithinParentContext (Graphics& g)
{
g.setOrigin (getPosition());
if (cachedImage != nullptr)
cachedImage->paint (g);
else
paintEntireComponent (g, false);
}
- OpenGLContext::CachedImage::paint() doesn’t do anything
void paint (Graphics&) override
{
updateViewportSize (false);
}
Sometimes this works, if you detach and then reattach the context it works, not sure why yet.
Update: attach / unattach is an unrelated issue, I call getTopLevelComponent () to attach OpenGL. In my constructor that just returns my editor component. At runtime it returns StandalonefilterWindow. So calling createComponentSnapshot
on a component using OpenGL works, but if any of the child components have OpenGL enabled, those child components appear as black.