Not sure if this has been covered - I couldn’t find it, but what’s the best way to get a Juce component as a complete image to use as a texture (with an alpha channel?
Ideally, I would like a callback, like a listener call, when the juce component (a window) or any of it’s children have drawn, so I can move it to a texture.
I guess I can’t do anything on a thread really, seeing as it’s drawing?
And is there a ‘fast path’ so I’m not wasting time doing actual screen drawing that will never be seen? If I don’t make the component visible, will it still draw? Or just when I ask it to? Seems like I’ll have to hook into the renderer somehow maybe?
Well, yes, but since the entire juce UI will be expressed via the image, I’d like to make sure I’m not drawing too many times, and that I do all the updates needed and no more.
It’s not that simple - comps are only drawn when a ComponentPeer needs something to put on-screen, and the repainting lives deep inside the platform-specific code. If they’re offscreen, there’s no repaint mechanism involved at all.
The “correct” way to do it would be to write a componentpeer that draws itself to a texture, and that would handle all interaction with the component. Quite a tricky job, though…