# Plugins with OpenGL don't work as VST2 under Wavelab on macOS

**URL:** <https://forum.juce.com/t/plugins-with-opengl-dont-work-as-vst2-under-wavelab-on-macos/19700>\
**Category:** Audio Plugins\
**Created:** [October 30, 2016, 2:39pm UTC](https://forum.juce.com/t/plugins-with-opengl-dont-work-as-vst2-under-wavelab-on-macos/19700 "2016-10-30T14:39:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![yairadix](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yairadix/32/1114_2.png) [@yairadix](https://forum.juce.com/u/yairadix)\
**Post date:** [October 30, 2016, 2:39pm UTC](https://forum.juce.com/t/plugins-with-opengl-dont-work-as-vst2-under-wavelab-on-macos/19700/1 "2016-10-30T14:39:50Z")

</div>

When opening the plugin GUI, Wavelab (tested with both 7 and 9) seems to shortly move the UI offscreen, which invokes `NSViewComponentPeer::redirectWillMoveToWindow`, which detaches the OpenGL context. Wavelab then moves it back to the screen but the OpenGL context stays detached…  
Also filed at the bug tracker at [https://github.com/julianstorer/JUCE/issues/120](https://github.com/julianstorer/JUCE/issues/120)

Running on macOS 10.12 with latest JUCE (develop branch).

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [November 1, 2016, 10:44am UTC](https://forum.juce.com/t/plugins-with-opengl-dont-work-as-vst2-under-wavelab-on-macos/19700/2 "2016-11-01T10:44:25Z")

</div>

Also tested with Yosemite 10.10.5, same results.

---

<div class="post-metadata">

**Author:** ![yairadix](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yairadix/32/1114_2.png) [@yairadix](https://forum.juce.com/u/yairadix)\
**Post date:** [November 7, 2016, 9:16am UTC](https://forum.juce.com/t/plugins-with-opengl-dont-work-as-vst2-under-wavelab-on-macos/19700/3 "2016-11-07T09:16:20Z")

</div>

This can be reproduced in a slightly modified JUCE demo plugin (to use OpenGL):

- Add the juce\_opengl module via the projucer
- Add an `OpenGLContext context;` member in `JuceDemoPluginAudioProcessorEditor`.
- Add `context.attachTo (*this); context.setContinuousRepainting (true); context.setRenderer (this);` in its constructor and `context.detach();` in the destructor.
- Make the editor inherit from `OpenGLRenderer` and add empty `void newOpenGLContextCreated() override {}` and `void openGLContextClosing() override {}` methods.
- Add `void renderOpenGL() override { glClearColor (1.0, 0.0, 0.0, 0.0); glClear (GL_COLOR_BUFFER_BIT); }` which paints a red background using OpenGL.
- Remove its `paint` method.

Now the demo plugin, with its new red background, should look like this (screenshot in Logic):

 ![](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/d/d8031acfd70764c6e5c1ab5f0e975edfd0bd7ec6.png)

In Wavelab, due to the context detaching by a work-around added in JUCE for debug assertions ([https://github.com/julianstorer/JUCE/issues/88](https://github.com/julianstorer/JUCE/issues/88)), it looks like this:

 ![](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/7/7cf9ce5a861c93226bf1b0d71f2fdaa8acb42414.png)

The lack of red background here indicates that OpenGL isn’t used here…

I would really appreciate a response to this, as this seems to clearly be a JUCE bug - the OpenGL context gets detached in `NSViewComponentPeer::redirectWillMoveToWindow` as if the plugin implementor deliberately decided it doesn’t need to be attached, and when Wavelab brings the view back into a window there’s nothing there to reattach it… So calling `detach` is probably not a good work-around for the previous problem.  
I wonder if the work-around for [issue 88](https://github.com/julianstorer/JUCE/issues/88) can safely be reverted, as I’d prefer false assertions in debug than the plugins not working in Wavelab (or any other host that shares it behavior).

---

<div class="post-metadata">

**Author:** ![goodhertz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/goodhertz/32/74_2.png) [@goodhertz](https://forum.juce.com/u/goodhertz)\
**Post date:** [January 14, 2017, 7:45am UTC](https://forum.juce.com/t/plugins-with-opengl-dont-work-as-vst2-under-wavelab-on-macos/19700/4 "2017-01-14T07:45:29Z")

</div>

Just to be clear, does this mean that Juce OpenGL doesn’t work in VST2 plugins at all? We’re seeing similar behavior in other hosts besides Wavelab.

---

<div class="post-metadata">

**Author:** ![yairadix](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yairadix/32/1114_2.png) [@yairadix](https://forum.juce.com/u/yairadix)\
**Post date:** [January 15, 2017, 9:38am UTC](https://forum.juce.com/t/plugins-with-opengl-dont-work-as-vst2-under-wavelab-on-macos/19700/5 "2017-01-15T09:38:27Z")

</div>

> [@hguthertz](#):
>
> Just to be clear, does this mean that Juce OpenGL doesn’t work in VST2 plugins at all?

JUCE’s OpenGL doesn’t work in VST2s in Wavelab on macOS. It does work in other hosts/systems, for example in Reaper.

> [@hguthertz](#):
>
> We’re seeing similar behavior in other hosts besides Wavelab.

In what other hosts do you see this behavior? Can you try building with this branch [GitHub - soundradix/JUCE: The JUCE cross-platform C++ framework / Sound Radix's fork](https://github.com/soundradix/JUCE) (where we fixed this problem) and see if it helps?

Cheers, Yair.

---

<div class="post-metadata">

**Author:** ![tadnicol](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tadnicol/32/5141_2.png) [@tadnicol](https://forum.juce.com/u/tadnicol)\
**Post date:** [April 4, 2017, 5:25pm UTC](https://forum.juce.com/t/plugins-with-opengl-dont-work-as-vst2-under-wavelab-on-macos/19700/6 "2017-04-04T17:25:46Z")

</div>

Thanks for those fixes Yair. So far it’s working for me (VST2 + macOS Sierra + WaveLab Elements 9 (VST3 does not work)). I’ll report any issues I run into.

---

<div class="post-metadata">

**Author:** ![yairadix](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yairadix/32/1114_2.png) [@yairadix](https://forum.juce.com/u/yairadix)\
**Post date:** [April 4, 2017, 7:24pm UTC](https://forum.juce.com/t/plugins-with-opengl-dont-work-as-vst2-under-wavelab-on-macos/19700/7 "2017-04-04T19:24:05Z")

</div>

For VST3, does it work in most recent JUCE tip? It was recently reported fixed at [Wavelab 9: presents blank plugin GUI](https://forum.juce.com/t/wavelab-9-presents-blank-plugin-gui/20729/8)

---

<div class="post-metadata">

**Author:** ![tadnicol](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tadnicol/32/5141_2.png) [@tadnicol](https://forum.juce.com/u/tadnicol)\
**Post date:** [April 4, 2017, 8:13pm UTC](https://forum.juce.com/t/plugins-with-opengl-dont-work-as-vst2-under-wavelab-on-macos/19700/8 "2017-04-04T20:13:51Z")

</div>

Ah yes it does! I had the VST3 build option disabled…forgot it wasn’t getting updated.
