While developing my Cinder-based audio/video instrument I've run into some complications I was anticipating, but still unsure of how to handle most effectively. My program will be rendering some video/visuals - partially by help of FBO's - which I'd like to display on a secondary window. I'm aware that FBO's cannot be shared across OpenGL Contexts, which as far as I am concerned, is fine.
Since I really just want my secondary window to output a flat 2d render, I am currently thinking the easiest way forward is simply to do 99% of the heavy lifting in the primary context, and share one solitary texture with the second context and render it as necessary. What I'm wondering is...
- How do I actually do this?
- Performance penalties?
- Alternate drawbacks?
Varying sources that I've read seem to indicate that Cinder/OpenGL automatically will share resources from the primary windows context with the secondary windows context, as long as they're created in this primary context? Which would lead me to think all I need to do is create single texture in the main context at any time, copy the FBO contents I want to draw into that and have the secondary window display that? Does that sound feasible?
Apart from the penalty of copying a texture, I fail to immediately see any performance drawbacks. I will likely want to render the contents of this FBO output in the primary window as well, so it seems like this is the smartest way forward to me.
I've tried to think if I might face problems down the road if the secondary interface suddenly becomes interactable - which I currently don't foresee happening. Even there it would seem keeping everything in the primary context is far (FAR) easier, no?