Plugin With OpenGL UI Won't Run in Plugin Host?

I’m developing plugin (currently VST only) that has a horizontally scrolling piano roll user interface implemented with OpenGL shaders. It’s working great when hosted in Ableton Live, but OpenGL won’t render when the plugin is loaded into the Juce Plugin Host.

Nothing related to GL thread is being called, such as newOpenGLContextCreated() and renderOpenGL().

I think the direct cause of problem is in this section of juce_OpenGLContext.cpp:

JobStatus runJob() override
        // Allow the message thread to finish setting-up the context before using it..
        MessageManagerLock mml (this);
        if (! mml.lockWasGained())        //This is returning false
            return ThreadPoolJob::jobHasFinished;    //We are not getting to here

It’s failing to obtain a lock on the message manager. Is this is because the Plugin Host also has a message manager, and if so how can I avoid the conflict?

Hi chrisgr,

I was able to reproduce your bug - any plug-in made with JUCE that has an OpenGL view would not load correctly in the JUCE plug-in host. I now fixed this bug on develop. However, it didn’t have anything to do with the MessageManagerLock so it would be good if you could test the fix to confirm that this did in-deed fix the bug.

​Great, thanks! I’ll let you know how testing goes.​

It works for me now. The Plugin’s openGL UI displays normally in Plugin Host.

However there was something else in the dev build that prevented my plugin from building whereas 4.2.4 was fine.

Something about these lines in PluginProcessor.h:

#ifndef JucePlugin_PreferredChannelConfigurations
bool setPreferredBusArrangement(bool isInput, int bus, const AudioChannelSet& preferredSet) override;

It seemed to not like the override.

I didn’t have time to track that down so I went back to 4.2.4. and manually edited in just the changes to the file, which solves my problem for now.

The API for dealing with busses has changed. See this thread for more info. But of course you can also just cherry pick the fix.