From 364126d86c2b1586155893b8a575dd225b8bdd56 Mon Sep 17 00:00:00 2001 From: nekocode Date: Mon, 8 Aug 2016 16:47:12 +0800 Subject: [PATCH] Fix pixelize filter's issue --- README.md | 2 +- app/src/main/res/raw/pixelize.fsh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1e060c0..3d3d8fe 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Realtime camera filters. Process frames by OpenGL shaders. -**[Download the apk](https://github.com/WeLikeVis/CameraFilter/releases/download/1.2/app-debug.apk)** to have a try. +**[Download the apk](https://github.com/WeLikeVis/CameraFilter/releases/download/1.2.1/app-debug.apk)** to have a try. ## Filters diff --git a/app/src/main/res/raw/pixelize.fsh b/app/src/main/res/raw/pixelize.fsh index 31e1742..d3e489d 100644 --- a/app/src/main/res/raw/pixelize.fsh +++ b/app/src/main/res/raw/pixelize.fsh @@ -6,10 +6,11 @@ uniform vec3 iResolution; uniform samplerExternalOES sTexture; varying vec2 texCoord; -void mainImage(out vec4 f,vec2 u) +#define S (iResolution.x / 6e1) // The cell size. + +void mainImage(out vec4 c, vec2 p) { - vec2 r = iResolution.xy; - f = texture2D(sTexture,ceil(u / (r.x/1e2)) * r.x/1e2 / r); + c = texture2D(sTexture, floor((p + .5) / S) * S / iResolution.xy); } void main() {