Last active
June 10, 2016 20:32
-
-
Save weavejester/65a44ed7358abba6a11a3e500e7cb148 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precision mediump float; | |
varying vec2 vTextureCoord; | |
uniform sampler2D uSampler; | |
uniform vec2 dimensions; | |
void main(void) { | |
vec2 pixelSize = vec2(1.0) / dimensions; | |
vec4 pixel = texture2D(uSampler, vTextureCoord); | |
vec4 pixelUp = texture2D(uSampler, vTextureCoord - vec2(0.0, pixelSize.y)); | |
vec4 pixelDown = texture2D(uSampler, vTextureCoord + vec2(0.0, pixelSize.y)); | |
vec4 pixelLeft = texture2D(uSampler, vTextureCoord - vec2(pixelSize.x, 0.0)); | |
vec4 pixelRight = texture2D(uSampler, vTextureCoord + vec2(pixelSize.x, 0.0)); | |
if (pixel.a == 0.0 && (pixelUp.a > 0.0 || | |
pixelDown.a > 0.0 || | |
pixelLeft.a > 0.0 || | |
pixelRight.a > 0.0)) { | |
pixel = vec4(1.0, 0.0, 0.0, 1.0); | |
} | |
gl_FragColor = pixel; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment