diff options
author | Zack Rusin <[email protected]> | 2008-06-16 13:19:41 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2008-07-21 19:19:22 -0400 |
commit | 4d38d86b2c5e572b1ea5ff4a5a84acb7ab5b87fc (patch) | |
tree | 22c5ad1630b6cab24cfb852f5f319a0825a661bd /progs/glsl/convolutions.c | |
parent | ec9c79a7dd468f3bd0483d3a9d59809bf019e54b (diff) |
add edge detection to that example
Diffstat (limited to 'progs/glsl/convolutions.c')
-rw-r--r-- | progs/glsl/convolutions.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/progs/glsl/convolutions.c b/progs/glsl/convolutions.c index be887714c4f..9b9ee532453 100644 --- a/progs/glsl/convolutions.c +++ b/progs/glsl/convolutions.c @@ -12,6 +12,7 @@ enum Filter { SHARPEN, MEAN_REMOVAL, EMBOSS, + EDGE_DETECT, NO_FILTER, LAST }; @@ -146,6 +147,17 @@ static void fillConvolution(GLint *k, color[2] = 0.5; color[3] = 0.5; break; + case EDGE_DETECT: + k[0] = 1; k[1] = 1; k[2] = 1; + k[3] = 0; k[4] = 0; k[5] = 0; + k[6] = -1; k[7] = -1; k[8] = -1; + + *scale = 1.; + color[0] = 0.5; + color[1] = 0.5; + color[2] = 0.5; + color[3] = 0.5; + break; case NO_FILTER: k[0] = 0; k[1] = 0; k[2] = 0; k[3] = 0; k[4] = 1; k[5] = 0; @@ -294,6 +306,7 @@ static void menuInit() glutAddMenuEntry("Sharpen", SHARPEN); glutAddMenuEntry("Mean removal", MEAN_REMOVAL); glutAddMenuEntry("Emboss", EMBOSS); + glutAddMenuEntry("Edge detect", EDGE_DETECT); glutAddMenuEntry("None", NO_FILTER); glutAddMenuEntry("Quit", QUIT); |