X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=sobel.frag;h=4fd12a37d40025241bd7bf8f5dab80eb63146fa2;hb=a75370343264a46e8addeff4973c7267e8ff2146;hp=e6b377f2a54fab04a99cef15549f2e4cec9cc567;hpb=bcdff7b1a183d7ff138a920997182d00f2decf0e;p=nageru diff --git a/sobel.frag b/sobel.frag index e6b377f..4fd12a3 100644 --- a/sobel.frag +++ b/sobel.frag @@ -4,7 +4,7 @@ in vec2 tc; out vec2 gradients; uniform sampler2D tex; -uniform float inv_width, inv_height; +uniform vec2 inv_image_size; void main() { @@ -19,13 +19,13 @@ void main() // Computing both at once allows us to get away with eight // texture samples instead of twelve. - float x_left = tc.x - inv_width; + float x_left = tc.x - inv_image_size.x; float x_mid = tc.x; - float x_right = tc.x + inv_width; + float x_right = tc.x + inv_image_size.x; - float y_top = tc.y + inv_height; // Note the bottom-left coordinate system. + float y_top = tc.y + inv_image_size.y; // Note the bottom-left coordinate system. float y_mid = tc.y; - float y_bottom = tc.y - inv_height; + float y_bottom = tc.y - inv_image_size.y; float top_left = texture(tex, vec2(x_left, y_top)).x; float left = texture(tex, vec2(x_left, y_mid)).x;