How to do smooth OpenGL in a Plugin?


I have a simple audio plugin that is rendering some animated graphic (a single moving line). I tried two methods for refreshing the display: (1) setContinuousRepainting(true) and (2) startTimerHz(60) + triggerRepaint()

In (1) all input to the JUCE UI Components becomes really laggy as soon as playback starts - and it stays laggy even when playback in the host is stopped - but it becomes responsive again after the plugin UI is re-opened or when the focus is switched away from the host and back to the host again.

In (2) the refresh rate is uneven, meaning, that frames are skipped and the animation is therefore not very smooth.

I’m on macOS 10.11.6 on a fairly beefy Mac Pro and the Host I tried is Ableton Live, but customers are reporting issues with both methods on Windows (FL Studio) as well.

So how can I get smooth regular repaints AND a responsive UI? Any input/help is really appreciated, I’m pulling my hair out over this for way too long now.

Further thoughts:

  • Presumably the laggy UI in (1) is somehow related to the OSes Message-Queue
  • Instruments showed nothing obvious.
  • I’m on the latest master.
  • the glorious “SlugPlug” source files are attached.

PluginProcessor.h (2.3 KB)
PluginProcessor.cpp (5.5 KB)
MainComponent.cpp (5.2 KB)
MainComponent.h (2.6 KB)

1 Like

Please try this again on the latest develop. See this forum thread for details: