How to draw lines

Draw lines using the gl.LINES drawing mode.

data

Vertice Index x y
0 0 2 2
1 1 10 2
2 2 2 3.5
3 3 10 3.5
4 4 2 6
5 5 10 14
6 6 12 2
7 7 20 3
8 8 12 5
9 9 20 6.5
10 10 12 8
11 11 20 10

pixel

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

Fragment Shader

precision mediump float;uniform vec2 u_resolution;void main() { gl_FragColor = vec4(1., 0., 0.0, 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);}