I have a texture generated on the fly (via FBO) with the model shadow. This is a black and transparent texture with - of course - many stair steps between (on/off) pixels.
I was thiking to add Gaussian Blur on the whole bitmap. I found the algorithm you see below but it works pixel by pixel.
Now the questions are:
Does OpenGL provide some built in algorithm to do this?
What is the fastest method to change pixel color on a texture?
Does some other different approach exist to obtain the same result?
As you can see in that algorithm… do the same… but you cant write (setpixel) into the same texture. So… do the ping-pong… create another texture (same size as original) and do horizontal blur. Then use that new texture as source for vertical blur.
fbo1 is original fbo
fbo2 is temporary fbo
fbo2 = horizontal_blur(fbo1) // step 1.. read from fbo1, write to fbo2
fbo1 = vertical_blur(fbo2) // step 2.. read from fbo2, write to fbo1
now, fbo1 contains blurred image.
Even more, you can repeat step1 and step2 several times to blur more.
I got answer for the above question.
But now I have another question, in the earlier example of a fragment shader it uses 7x1 matrix.
What if I want to use 7x7 matrix?
Hi Vexator I have one question, in the earlier example of a fragment shader it uses 7x1 matrix.
What if I want to use 7x7 matrix? Do I have to use a nested loop with u_Scale = vec2(1.0/width, 1.0/height )