Best approach to applying GLSL shaders to Components?

JUCE’s OpenGL implementation is considerably more challenging to use (and optimise!) when compared to QT or the likes, so I’m wondering if anybody has had any experience applying shaders to Components - and what have the results been like?

I’m looking to implement and contextually use GPU-based drop shadows and blurs instead of bottlenecking the CPU unnecessarily - but this is proving to be non-evident.

ie: Showing a drop shadow underneath a CallOutBox, but using a shader (not CPU-bound pixel mashing like DropShadowEffect/DropShadow/DropShadower do).

I used DropShadowEffect to display shadow for a component and it resulted in poor performance when the component was displayed. The whole application became sluggish. After doing some time profiling using Instruments, I found that blurDataTriplets in DropShadowEffect is consuming a lot of time.
To overcome the performance issue, I painted shadow from the paint method of the component, though the appearance of shadow was not as crisp as using DropShadowEffect.

I’m saddened by the lack of input on this one.

I guess this means it’s not possible to change up anything from a Component via the GL pipeline? We’re stuck hand-rolling our own Component drawing strategy?

3 Likes