How to draw a full image
Draw a full gradient using two vertices (a "quad") which cover the entire frame.
Draw a full gradient using two vertices (a "quad") which cover the entire frame.
Vertice | Index | x | y |
---|---|---|---|
0 | 0 | 0 | 0 |
1 | 1 | 512 | 0 |
2 | 2 | 0 | 288 |
3 | 3 | 0 | 288 |
4 | 4 | 512 | 288 |
5 | 5 | 512 | 0 |
precision mediump float;uniform vec2 u_resolution;uniform float u_time;#define PI 3.14void main() { vec2 uv = gl_FragCoord.xy / u_resolution.xy; gl_FragColor = vec4(uv.x, uv.y, uv.x * uv.y, 1.0);}
precision mediump float;attribute vec2 a_position;uniform vec2 u_resolution;void main() { vec2 pos = a_position / u_resolution * 2.0 - 1.0; gl_Position = vec4(pos.x, -pos.y, 0.0, 1.0);}