-
-
Notifications
You must be signed in to change notification settings - Fork 480
/
Copy pathbasic.frag
22 lines (17 loc) · 855 Bytes
/
basic.frag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// casey conchinha - @kcconch ( https://github.com/kcconch )
// louise lessel - @louiselessel ( https://github.com/louiselessel )
// more p5.js + shader examples: https://itp-xstory.github.io/p5js-shaders/
// this is a modification of a shader by adam ferriss
// https://github.com/aferriss/p5jsShaderExamples/tree/gh-pages/2_texture-coordinates/2-1_basic
precision mediump float;
// this is the same variable we declared in the vertex shader
// we need to declare it here too!
varying vec2 vTexCoord;
void main() {
// copy the vTexCoord
// vTexCoord is a value that goes from 0.0 - 1.0 depending on the pixels location
// we can use it to access every pixel on the screen
vec2 coord = vTexCoord;
// x values for red, y values for green, both for blue
gl_FragColor = vec4(coord.x, coord.y, (coord.x+coord.y), 1.0 );
}