/clases/clase1/ init checkpoint 0 checkpoint 1 checkpoint 2 bonus
xxxxxxxxxx
1
// Author: Sol Sarratea @solquemal
2
// Title: Clase 1 - Descripción de figuras
3
precision mediump float;
4
5
//Variables uniformes: puentes entre CPU y GPU
6
//-------------------------------
7
uniform float u_time;
8
uniform vec2 u_resolution;
9
10
// main: función principal del shader
11
void main() {
12
    vec2 pos = gl_FragCoord.xy/u_resolution; 
13
    pos.x *= u_resolution.y/u_resolution.x;  // Factor de escala
14
    // Nota: eventualmente este canvas al tener misma alto y ancho estamos multiplicando por 1 ->
15
    // Rango de UV = [0,1]x[0x1]
16
17
    vec3 color;
18
    color.rb = pos; // Asignamos en los canales rojo y azul los valores de UV
19
20
    gl_FragColor = vec4(color,1.);
21
}
22
23
24
25
26
27
28
29