How to draw a full image

Draw a full gradient using two vertices (a "quad") which cover the entire frame.

data

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

pixel

r
0
g
0
b
0
a
0
x
0
y
0

Fragment Shader

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);}

Vertex Shader

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);}