File: pixelate.frag

package info (click to toggle)
olive-editor 20181223-2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 2,844 kB
  • sloc: cpp: 20,147; xml: 315; ansic: 16; makefile: 11
file content (20 lines) | stat: -rw-r--r-- 386 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#version 110

varying vec2 vTexCoord;
uniform sampler2D texture;
uniform float pixels_x;
uniform float pixels_y;
uniform bool bypass;

void main(void) {
	if (bypass) {
		gl_FragColor = texture2D(texture, vTexCoord);
	} else {
		vec2 p = vTexCoord;

		p.x -= mod(p.x, 1.0 / pixels_x);
		p.y -= mod(p.y, 1.0 / pixels_y);

		gl_FragColor = texture2D(texture, p);
	}  	
}