Is OpenGL faster than JUCE graphics?

I’ve been having some trouble displaying an FFT using various drawing functions like paths and drawLine(). This has got me curious about OpenGL and whether that might be better? I think I read somewhere that it was faster, is that the case? Alternatively, is there a better way to use Juce graphics? This is my drawing loop:

              for (int r = 0; dr < f1.fftSize/2; r++)


               g.drawLine(logScale[r], 300, logScale[r], outC[r], 2);


(outC is the fft result and fftSize = 8192)
When I use paths the plugin just completely freezes, and with drawLine() its just slow.
Is there a better way?

If you write your own shaders it’s definitely going to be a whole lot faster. Simplest way would be to send the FFT amplitude points to a geometry shader and use that to create the “curve” shape of the display.


you can set colour and opacity before the loop if you don’t plan to change it dynamically with the measured data or something

1 Like