I have made a goniometer component for a plugin I am developing, and was curious to see if I could replicate the glow effect seen in the latest version of Flux Stereo Tool plugin. They seem to achieve the glow by blurring the graph image before drawing a new buffer on it, which causes previous buffers to become blurrier over successive repaints.
My plugin is repainting at 25fps and with the gaussian blur enabled the frame rate drops noticeably and CPU usage jumps (as measured in my DAW, Reaper). On the other hand Stereo Tool repaints at 30fps and stays perfectly smooth, and barely touches the CPU. My guess is that they are using hardware acceleration to render their goniometer?
The fancy blur isn’t necessary for my plugin, but I am curious how one would go about implementing that sort of animated eye candy in Juce without compromising performance?
Yeah, JUCE’s Gaussian blur is insanely slow and isn’t designed for animated stuff as far as I know.
What I would do is make the goniometer an OpenGL component (read: not using the JUCE OpenGL renderer, but a straight OpenGL context) and draw your data using two passes with different pixel shaders. That should be super fast!
It’s a gallery of pixel shaders, you just need to copy and paste the shaders code in a JUCE project which handles OpenGL and shaders (have a look for the demo examples and the OpenGLGraphicsContextCustomShader class), and you get the same result, accelerated by the hardware GPU.
Maybe you can fake the blurring a bit by using a Trails like effect. So instead of a Blur just keep a copy of the previous paint (in an Image) and draw on top of that. In this case you only need an Alpha blend.
Good suggestion, and I am already doing that. You need an “afterimage” for a goniometer I think, otherwise the visual information changes too quickly to make sense of. The blurring effect would be purely eye candy!