How to draw points
Draw points using the gl.POINTS drawing mode.
Draw points using the gl.POINTS drawing mode.
Vertice | Index | x | y |
---|---|---|---|
0 | 0 | 10 | 5 |
1 | 1 | 44 | 10 |
2 | 2 | 24 | 20 |
3 | 3 | 50 | 15 |
4 | 4 | 94 | 20 |
5 | 5 | 44 | 30 |
precision mediump float;uniform vec2 u_resolution;void main() { vec2 uv = gl_FragCoord.xy / u_resolution.xy; if (gl_FragCoord.x == 11.50) { gl_FragColor = vec4(1., 0., 0.0, 1.0); } else { gl_FragColor = vec4(uv.x, uv.y, 0.7, 1.0); }}
precision mediump float;attribute vec2 a_position;uniform vec2 u_resolution;uniform float u_time;void main() { vec2 pos = a_position / u_resolution * 2.0 - 1.0; float x = sin(u_time) / 4. + pos.x; float y = cos(u_time) / 4. + pos.y; gl_Position = vec4(x, -y, 0.0, 1.0);}