I was looking into fast glsl blur effects which render quickly regardless of size. That led me to this article that describes the use of box blurs to simulate Gaussian blurs.
The box blur is faster for large kernels since a weighted average can be used. However to use a weighted average you need to read the pixels from a texture individually.
That's impossible I thought! Until I saw this line of code in their fragment shader on line 7:
imageStore( uTex1, ivec2( x, y ), vec4( colourSum * recKernelSize, 1.0 )
I looked at the openGL wiki and found this page, which describes using images like 2d arrays, where you can access pixels arbitrarily.
However setting this up you need to use image units instead of texture units. I tried to find documentation on this for webgl, but even google left me with nothing.
So can image units be utilized in webgl, and if so how would I go about setting one up?
Edit: Also can an existing texture be converted into an image unit?