Hi,
I’ve written an edge detect shader and after bashing my head against a wall I got it working, but I’m not sure why.
First off, this reference Orange Book, section 19.7.2 (and I’m sure there were others, or similar), shows a convolution matrix of
0, 1, 0
1,-4, 1
0, 1, 0
but that will produce a -ve final vector and if I set gl_FragColor it then I get black. So I had to negate the above matrix. I’m I missing something?
The second thing is I am rendering a 2048x2048 texture to a 128x128 texture. I thought the offsets to move the sample coord would be 1/2048 (e.g. add 1/2048,1/2048 to S,T to sample the pixel 1 to the right and 1 up from the current pixel), but I had to use 1/128. Don’t undertand why.
Thanks,
Stuart.