OpenGLContext, OS X, Plugins, and Scaling

JUCE 4.2, latest develop:

We’re having a hell of a time adding interface scaling to our plug-ins. We’ve been using the SoundRadix fork for a while, but ran into this bug. We’ve switched to the main develop branch to try to troubleshoot this.

So, we have a PluginEditor. We also have an OpenGLContext (continuous repaint enabled) that is attached to the editor. To do interface scaling, we’re resizing the window and applying an affine transform to scale the component.

setSize(getPluginMainWidth() * getInterfaceScale(), getPluginMainHeight() * getInterfaceScale()); setTransform(AffineTransform::scale(getInterfaceScale()));

This scaling code works perfectly without the OpenGLContext in every single host that we’ve tested.

When OpenGLContext is enabled, everything breaks. The interface is rendered at a vertical offset (but clicking on the interface shows that controls are positioned where they should be). This occurs on Windows and OS X.

On Windows, the following SoundRadix commit fixes this issue:


With this commit, we’re able to use OpenGLContext with our resizing code in every tested host.

On OS X, we have found nothing that works. The SoundRadix patch does not fix it for us. JUCE 4.2.1 master and develop branches do not work either.

We require OpenGLContext for our plug-ins, or else we face a number of rendering issues.

Working interface on bottom. Broken, scaled interface on top.

Can you give us some code to try ourselves that would reproduce this?

Just one quick thought: if there are problems in attaching a GL context to a transformed Component, it’ll almost certainly work just fine if you attach the context to a non-scaled top-level Component which contains a scaled sub-component that contains all your content.

Okay, we went through the process of redoing a plugin so that the top-level Component (of type AudioProcessorEditor) has an attached GL Context, and the transformed, visible user interface is a child Component.

It had the weird effect of semi-fixing the plugin on OS X when using the SoundRadix branch. However, official 4.2.1 develop is still broken. Worse still, when using the SoundRadix branch the plug-in renders fine on our personal computers, but is broken on two testers’ computers.

For tester code, just have an openGLContext as a private member of your editor. Set continuous repainting to true and attach it to the component in the constructor. Then, use the code I posted above (or something similar). Set the size of the plug-in to twice its current size, and then set an Affine scale transform to 2.0.

Is it possible to add an official way to scaled AudioProcessorEditors? It seems like complete chaos regarding how each host handles scaling. Before we used the AffineTransform method, we used Desktop’s globalScale. This worked fine in many hosts, but failed in Ableton Live. Regardless, it seems that OpenGLContext is not scaling correctly on the official branch.

Some more bug notes:

EDIT… IGNORE THIS:

On OS X, using the SoundRadix branch, using a Retina display with Pro Tools will force the plug-in to scale incorrectly. Using a non-Retina external monitor results in the plug-in scaling correctly again.

Oddly, the scaling works correctly in Ableton as a VST. Something about AAX is causing chaos here.

The Retina bug was an issue with our implementation order. SoundRadix branch works for scaling OpenGLContext, but official JUCE does not.

1 Like