# Multi-Window Rendering - path of least resistance

**URL:** <https://discourse.libcinder.org/t/multi-window-rendering-path-of-least-resistance/564>\
**Category:** Using Cinder\
**Created:** [February 18, 2017, 11:42am UTC](https://discourse.libcinder.org/t/multi-window-rendering-path-of-least-resistance/564 "2017-02-18T11:42:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gazoo](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/gazoo/32/61_2.png) [@Gazoo](https://discourse.libcinder.org/u/Gazoo)\
**Post date:** [February 18, 2017, 11:42am UTC](https://discourse.libcinder.org/t/multi-window-rendering-path-of-least-resistance/564/1 "2017-02-18T11:42:37Z")

</div>

Hey Embers,

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?

Regards,

Gazoo

---

<div class="post-metadata">

**Author:** ![paul.houx](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/paul.houx/32/31_2.png) [@paul.houx](https://discourse.libcinder.org/u/paul.houx)\
**Post date:** [February 18, 2017, 8:41pm UTC](https://discourse.libcinder.org/t/multi-window-rendering-path-of-least-resistance/564/2 "2017-02-18T20:41:31Z")

</div>

Hint: an `Fbo` can not be shared between contexts, but a `Texture` can be 🙂

---

<div class="post-metadata">

**Author:** ![Gazoo](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/gazoo/32/61_2.png) [@Gazoo](https://discourse.libcinder.org/u/Gazoo)\
**Post date:** [February 18, 2017, 11:38pm UTC](https://discourse.libcinder.org/t/multi-window-rendering-path-of-least-resistance/564/3 "2017-02-18T23:38:27Z")

</div>

@paul.houx - Many thanks for the tip 🙂 - although I feel as though my text highlights my awareness this approach? I know the right thing is to just try it, which I intend to do now - I couldn’t help myself to ask if anyone might perceive some downsides or issues that I highlight?

---

<div class="post-metadata">

**Author:** ![paul.houx](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/paul.houx/32/31_2.png) [@paul.houx](https://discourse.libcinder.org/u/paul.houx)\
**Post date:** [February 19, 2017, 12:18am UTC](https://discourse.libcinder.org/t/multi-window-rendering-path-of-least-resistance/564/4 "2017-02-19T00:18:17Z")

</div>

I think most of what you wrote is correct and should work. My hint was aimed at how you’d render to an `Fbo`. You don’t have to copy from the `Fbo` to another `Texture`, just use the shared `Texture` as the target of the `Fbo` and render directly to it on the main thread. Then unbind the `Fbo` and display the `Texture` in the second window.

---

<div class="post-metadata">

**Author:** ![rsodre](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/rsodre/32/140_2.png) [@rsodre](https://discourse.libcinder.org/u/rsodre)\
**Post date:** [February 24, 2017, 8:23pm UTC](https://discourse.libcinder.org/t/multi-window-rendering-path-of-least-resistance/564/5 "2017-02-24T20:23:23Z")

</div>

You can easily do that compiling two applications and sharing the texture with Syphon.
