Use either OpenGL or software rendering

Here’s my situation: I want my game to have maximum compatability, and I want to use a metaball effect (which is basically a blur + threshold filter).

Unfortunately (and unsurprisingly), this ended up being slow when done with direct pixel manipulation (~20fps on an old laptop), but since the effect is only an aethestic thing and isn’t necessary, I thought to make it available only when OpenGL is available (And use the basic SDL2 functionality but hackily switch shader programs before drawing my filtered objects).

So ultimately I plan on supporting OpenGL and SW, and would like to setup my renderer to use GL first, and if unsupported, use SW. This means no Vulkan, D3D, and whatever else SDL2 usually supports. How would I go about doing that?