gridviz 3.0.23 → 3.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +128 -128
  2. package/dist/gridviz.js +8617 -8579
  3. package/dist/gridviz.min.js +1 -1
  4. package/package.json +74 -74
  5. package/src/button/Button.js +67 -67
  6. package/src/button/FullscreenButton.js +121 -121
  7. package/src/button/ZoomButtons.js +103 -101
  8. package/src/core/Dataset.js +154 -154
  9. package/src/core/Drawable.js +78 -78
  10. package/src/core/GeoCanvas.js +438 -430
  11. package/src/core/Layer.js +23 -23
  12. package/src/core/Legend.js +108 -108
  13. package/src/core/Map.js +544 -516
  14. package/src/core/MultiResolutionDataset.js +93 -93
  15. package/src/core/Style.js +98 -98
  16. package/src/core/Tooltip.js +182 -182
  17. package/src/dataset/COGeo.js +25 -25
  18. package/src/dataset/CSVGrid.js +112 -112
  19. package/src/dataset/GeoTIFF.js +122 -122
  20. package/src/dataset/JSGrid.js +55 -55
  21. package/src/dataset/TiledGrid.js +302 -302
  22. package/src/dataset/worker.js +18 -18
  23. package/src/index.js +77 -77
  24. package/src/layer/BackgroundLayer.js +173 -173
  25. package/src/layer/BackgroundLayerImage.js +81 -81
  26. package/src/layer/BackgroundLayerWMS.js +104 -104
  27. package/src/layer/GeoJSONLayer.js +214 -214
  28. package/src/layer/GridLayer.js +148 -148
  29. package/src/layer/LabelLayer.js +194 -194
  30. package/src/legend/ColorCategoryLegend.js +109 -109
  31. package/src/legend/ColorDiscreteLegend.js +100 -100
  32. package/src/legend/ColorLegend.js +115 -115
  33. package/src/legend/OrientationLegend.js +89 -89
  34. package/src/legend/SizeLegend.js +224 -224
  35. package/src/legend/TernaryLegend.js +302 -302
  36. package/src/style/CompositionStyle.js +291 -291
  37. package/src/style/ContourStyle.js +21 -21
  38. package/src/style/DotDensityStyle.js +133 -133
  39. package/src/style/ImageStyle.js +100 -100
  40. package/src/style/IsoFenceStyle.js +217 -217
  41. package/src/style/JoyPlotStyle.js +127 -127
  42. package/src/style/LegoStyle.js +110 -110
  43. package/src/style/MosaicStyle.js +99 -99
  44. package/src/style/NinjaStarStyle.js +102 -102
  45. package/src/style/PillarStyle.js +207 -207
  46. package/src/style/SegmentStyle.js +105 -105
  47. package/src/style/ShapeColorSizeStyle.js +147 -147
  48. package/src/style/SideCategoryStyle.js +112 -112
  49. package/src/style/SideStyle.js +212 -212
  50. package/src/style/SquareColorCategoryWebGLStyle.js +107 -107
  51. package/src/style/SquareColorWebGLStyle.js +126 -126
  52. package/src/style/StrokeStyle.js +135 -135
  53. package/src/style/TanakaStyle.js +69 -69
  54. package/src/style/TextStyle.js +110 -110
  55. package/src/style/TimeSeriesStyle.js +222 -222
  56. package/src/utils/WebGLRectangleColoring.js +106 -106
  57. package/src/utils/WebGLSquareColoring.js +118 -118
  58. package/src/utils/WebGLSquareColoringAdvanced.js +230 -230
  59. package/src/utils/WebGLSquareColoringCatAdvanced.js +133 -133
  60. package/src/utils/WebGLSquareColoringKS.js +153 -153
  61. package/src/utils/scale.js +218 -218
  62. package/src/utils/stretching.js +120 -120
  63. package/src/utils/ternary.js +208 -208
  64. package/src/utils/utils.js +58 -58
  65. package/src/utils/webGLUtils.js +72 -72
  66. package/src/utils/zoomUtils.js +142 -142
@@ -1,230 +1,230 @@
1
- //@ts-check
2
- 'use strict'
3
-
4
- import { initShaderProgram, createShader } from './webGLUtils.js'
5
- import { color } from 'd3-color'
6
-
7
- /**
8
- * Everything to easily draw colored squares with webGL.
9
- * All the same size, but different fill color.
10
- * The color interpolation is computed in the fragment shader program, by the GPU, thus it is less flexible but faster.
11
- */
12
- export class WebGLSquareColoringAdvanced {
13
- //see:
14
- //https://webglfundamentals.org/webgl/lessons/fr/webgl-shaders-and-glsl.html#les-uniforms-dans-les-shaders-de-vertex
15
- //https://thebookofshaders.com/glossary/?search=mix
16
- //https://thebookofshaders.com/06/
17
- //https://thebookofshaders.com/glossary/
18
-
19
- /**
20
- *
21
- * @param {*} gl
22
- * @param {Array.<String>} colors
23
- * @param {{fun:string,alpha:number}} stretching
24
- * @param {number} sizePix
25
- * @param {number|undefined} globalOpacity
26
- */
27
- constructor(gl, colors, stretching, sizePix = 10, globalOpacity = undefined) {
28
- /** @type {WebGLRenderingContext} */
29
- this.gl = gl
30
- //gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
31
- //gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
32
- //gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
33
-
34
- /** @type {WebGLShader} */
35
- const vShader = createShader(
36
- gl,
37
- gl.VERTEX_SHADER,
38
- `
39
- attribute vec2 pos;
40
- uniform float sizePix;
41
- uniform mat3 mat;
42
-
43
- attribute float t;
44
- varying float vt;
45
-
46
- void main() {
47
- gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);
48
- gl_PointSize = sizePix;
49
- vt = t;
50
- }
51
- `
52
- )
53
-
54
- //prepare fragment shader code
55
- //declare the uniform and other variables
56
- let fshString =
57
- '' +
58
- 'precision mediump float;\n' +
59
- 'varying float vt;\n' +
60
- 'uniform float alpha;\n' +
61
- (() => {
62
- const out = []
63
- for (let i = 0; i < colors.length; i++) out.push('uniform vec4 c' + i + ';\n')
64
- return out.join('')
65
- })() +
66
- //start the main function, apply the stretching of t
67
- 'void main(void) {\n'
68
-
69
- if (stretching) {
70
- if (stretching.fun == 'pow')
71
- //sPow = (t, alpha = 3) => Math.pow(t, alpha);
72
- fshString += ' float t = pow(vt, alpha);\n'
73
- else if (stretching.fun == 'powInv')
74
- //sPowRev = (t, alpha = 3) => 1 - Math.pow(1 - t, 1 / alpha);
75
- fshString += ' float t = 1.0-pow(1.0-vt, 1.0/alpha);\n'
76
- else if (stretching.fun == 'exp')
77
- //sExp = (t, alpha = 3) => alpha == 0 ? t : (Math.exp(t * alpha) - 1) / (Math.exp(alpha) - 1);
78
- fshString +=
79
- stretching.alpha == 0
80
- ? `float t = vt;`
81
- : ' float t = (exp(vt * alpha) - 1.0) / (exp(alpha) - 1.0);\n'
82
- else if (stretching.fun == 'log')
83
- //sExpRev = (t, alpha = 3) => alpha == 0 ? t : 1 - (1 / alpha) * Math.log(Math.exp(alpha) * (1 - t) + t);
84
- fshString +=
85
- stretching.alpha == 0
86
- ? `float t = vt;`
87
- : ' float t = 1.0 - (1.0 / alpha) * log(exp(alpha) * (1.0 - vt) + vt);\n'
88
- else if (stretching.fun == 'circle') {
89
- if (stretching.alpha == 0)
90
- //if (alpha == 0) return t;
91
- fshString += ' float t = vt;\n'
92
- else if (stretching.alpha == 1)
93
- // if (alpha == 1) return Math.sqrt(2 * t - t * t);
94
- fshString += ' float t = sqrt(vt * (2.0 - vt));\n'
95
- else {
96
- //const a = alpha / (1 - alpha);
97
- //return Math.sqrt(1 / (a * a) + t * (2 / a + 2 - t)) - 1 / a;
98
- fshString +=
99
- ' float a = alpha / (1.0 - alpha);\n' +
100
- ' float t = sqrt(1.0 / (a * a) + vt * ( 2.0/a + 2.0 - vt )) - 1.0 / a;\n'
101
- }
102
- } else if (stretching.fun == 'circleInv') {
103
- // 1 - sCircleLow(1 - t, alpha)
104
- if (stretching.alpha == 0)
105
- //if (alpha == 0) return t;
106
- fshString += ' float t = vt;\n'
107
- else if (stretching.alpha == 1)
108
- // if (alpha == 1) return Math.sqrt(2 * t - t * t);
109
- fshString += ' float t = 1.0 - sqrt((1.0 - vt) * (1.0 + vt));\n'
110
- else {
111
- //const a = alpha / (1 - alpha);
112
- //return Math.sqrt(1 / (a * a) + (2 * t) / a + 2 * t - t * t) - 1 / a;
113
- fshString +=
114
- ' float a = alpha / (1.0 - alpha);\n' +
115
- ' float t = 1.0 - sqrt(1.0 / (a * a) + (1.0-vt) * ( 2.0/a + 1.0 + vt )) + 1.0 / a;\n'
116
- }
117
- } else {
118
- console.error('Unexpected stretching function code: ' + stretching.fun)
119
- fshString += ' float t = vt;\n'
120
- }
121
- } else {
122
- fshString += ' float t = vt;\n'
123
- }
124
-
125
- //choose initial and final colors, and adjust t value
126
- if (colors.length == 1) fshString += ' vec4 cI=c0;\n vec4 cF=c0;\n'
127
- else if (colors.length == 2) fshString += ' vec4 cI=c0;\n vec4 cF=c1;\n'
128
- else {
129
- const nb = colors.length - 1
130
- const nbs = nb + '.0'
131
- fshString += ' vec4 cI;\n'
132
- fshString += ' vec4 cF;\n'
133
- fshString += ' if(t<1.0/' + nbs + ') { cI=c0; cF=c1; t=t*' + nbs + '; }\n'
134
- for (let i = 2; i < nb; i++)
135
- fshString +=
136
- ' else if(t<' +
137
- i +
138
- '.0/' +
139
- nbs +
140
- ') { cI=c' +
141
- (i - 1) +
142
- '; cF=c' +
143
- i +
144
- '; t=' +
145
- nbs +
146
- '*t-' +
147
- (i - 1) +
148
- '.0; }\n'
149
- fshString +=
150
- ' else { cI=c' + (nb - 1) + '; cF=c' + nb + '; t=' + nbs + '*t-' + (nb - 1) + '.0; }\n'
151
- }
152
-
153
- //one single color
154
- if (colors.length == 1) fshString += ' gl_FragColor = vec4(c0[0], c0[1], c0[2], c0[3]);}\n'
155
- //set interpolated color, between initial and final one
156
- else fshString += ' gl_FragColor = mix(cI, cF, t);}\n'
157
-
158
- //console.log(fshString)
159
-
160
- /** @type {WebGLShader} */
161
- const fShader = createShader(gl, gl.FRAGMENT_SHADER, fshString)
162
-
163
- /** @type {WebGLProgram} */
164
- this.program = initShaderProgram(gl, vShader, fShader)
165
- gl.useProgram(this.program)
166
-
167
- //set uniforms
168
-
169
- //sizePix
170
- //TODO: bug here. Seems to be limited to some threshold value (around 250).
171
- gl.uniform1f(gl.getUniformLocation(this.program, 'sizePix'), 1.0 * sizePix)
172
-
173
- //stretching alpha factor
174
- gl.uniform1f(gl.getUniformLocation(this.program, 'alpha'), stretching ? 1.0 * stretching.alpha : 0.0)
175
-
176
- //colors
177
- for (let i = 0; i < colors.length; i++) {
178
- const c = color(colors[i])
179
-
180
- let opacity = c.opacity
181
- if (c.opacity == 1 && globalOpacity != undefined) opacity = globalOpacity
182
-
183
- gl.uniform4fv(gl.getUniformLocation(this.program, 'c' + i), [
184
- +c.r / 255.0,
185
- +c.g / 255.0,
186
- +c.b / 255.0,
187
- +opacity,
188
- ])
189
- }
190
- }
191
-
192
- /** */
193
- draw(verticesBuffer, tBuffer, transfoMat) {
194
- const gl = this.gl
195
- const program = this.program
196
-
197
- //vertice data
198
- gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer())
199
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(verticesBuffer), gl.STATIC_DRAW)
200
- const position = gl.getAttribLocation(program, 'pos')
201
- gl.vertexAttribPointer(
202
- position,
203
- 2, //numComponents
204
- gl.FLOAT, //type
205
- false, //normalise
206
- 0, //stride
207
- 0 //offset
208
- )
209
- gl.enableVertexAttribArray(position)
210
-
211
- //t data
212
- gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer())
213
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(tBuffer), gl.STATIC_DRAW)
214
- const t = gl.getAttribLocation(program, 't')
215
- gl.vertexAttribPointer(t, 1, gl.FLOAT, false, 0, 0)
216
- gl.enableVertexAttribArray(t)
217
-
218
- //transformation
219
- gl.uniformMatrix3fv(gl.getUniformLocation(program, 'mat'), false, new Float32Array(transfoMat))
220
-
221
- // Enable the depth test
222
- //gl.enable(gl.DEPTH_TEST);
223
- // Clear the color buffer bit
224
- gl.clear(gl.COLOR_BUFFER_BIT)
225
- // Set the view port
226
- //gl.viewport(0, 0, cg.w, cg.h);
227
-
228
- gl.drawArrays(gl.POINTS, 0, verticesBuffer.length / 2)
229
- }
230
- }
1
+ //@ts-check
2
+ 'use strict'
3
+
4
+ import { initShaderProgram, createShader } from './webGLUtils.js'
5
+ import { color } from 'd3-color'
6
+
7
+ /**
8
+ * Everything to easily draw colored squares with webGL.
9
+ * All the same size, but different fill color.
10
+ * The color interpolation is computed in the fragment shader program, by the GPU, thus it is less flexible but faster.
11
+ */
12
+ export class WebGLSquareColoringAdvanced {
13
+ //see:
14
+ //https://webglfundamentals.org/webgl/lessons/fr/webgl-shaders-and-glsl.html#les-uniforms-dans-les-shaders-de-vertex
15
+ //https://thebookofshaders.com/glossary/?search=mix
16
+ //https://thebookofshaders.com/06/
17
+ //https://thebookofshaders.com/glossary/
18
+
19
+ /**
20
+ *
21
+ * @param {*} gl
22
+ * @param {Array.<String>} colors
23
+ * @param {{fun:string,alpha:number}} stretching
24
+ * @param {number} sizePix
25
+ * @param {number|undefined} globalOpacity
26
+ */
27
+ constructor(gl, colors, stretching, sizePix = 10, globalOpacity = undefined) {
28
+ /** @type {WebGLRenderingContext} */
29
+ this.gl = gl
30
+ //gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
31
+ //gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
32
+ //gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
33
+
34
+ /** @type {WebGLShader} */
35
+ const vShader = createShader(
36
+ gl,
37
+ gl.VERTEX_SHADER,
38
+ `
39
+ attribute vec2 pos;
40
+ uniform float sizePix;
41
+ uniform mat3 mat;
42
+
43
+ attribute float t;
44
+ varying float vt;
45
+
46
+ void main() {
47
+ gl_Position = vec4(mat * vec3(pos, 1.0), 1.0);
48
+ gl_PointSize = sizePix;
49
+ vt = t;
50
+ }
51
+ `
52
+ )
53
+
54
+ //prepare fragment shader code
55
+ //declare the uniform and other variables
56
+ let fshString =
57
+ '' +
58
+ 'precision mediump float;\n' +
59
+ 'varying float vt;\n' +
60
+ 'uniform float alpha;\n' +
61
+ (() => {
62
+ const out = []
63
+ for (let i = 0; i < colors.length; i++) out.push('uniform vec4 c' + i + ';\n')
64
+ return out.join('')
65
+ })() +
66
+ //start the main function, apply the stretching of t
67
+ 'void main(void) {\n'
68
+
69
+ if (stretching) {
70
+ if (stretching.fun == 'pow')
71
+ //sPow = (t, alpha = 3) => Math.pow(t, alpha);
72
+ fshString += ' float t = pow(vt, alpha);\n'
73
+ else if (stretching.fun == 'powInv')
74
+ //sPowRev = (t, alpha = 3) => 1 - Math.pow(1 - t, 1 / alpha);
75
+ fshString += ' float t = 1.0-pow(1.0-vt, 1.0/alpha);\n'
76
+ else if (stretching.fun == 'exp')
77
+ //sExp = (t, alpha = 3) => alpha == 0 ? t : (Math.exp(t * alpha) - 1) / (Math.exp(alpha) - 1);
78
+ fshString +=
79
+ stretching.alpha == 0
80
+ ? `float t = vt;`
81
+ : ' float t = (exp(vt * alpha) - 1.0) / (exp(alpha) - 1.0);\n'
82
+ else if (stretching.fun == 'log')
83
+ //sExpRev = (t, alpha = 3) => alpha == 0 ? t : 1 - (1 / alpha) * Math.log(Math.exp(alpha) * (1 - t) + t);
84
+ fshString +=
85
+ stretching.alpha == 0
86
+ ? `float t = vt;`
87
+ : ' float t = 1.0 - (1.0 / alpha) * log(exp(alpha) * (1.0 - vt) + vt);\n'
88
+ else if (stretching.fun == 'circle') {
89
+ if (stretching.alpha == 0)
90
+ //if (alpha == 0) return t;
91
+ fshString += ' float t = vt;\n'
92
+ else if (stretching.alpha == 1)
93
+ // if (alpha == 1) return Math.sqrt(2 * t - t * t);
94
+ fshString += ' float t = sqrt(vt * (2.0 - vt));\n'
95
+ else {
96
+ //const a = alpha / (1 - alpha);
97
+ //return Math.sqrt(1 / (a * a) + t * (2 / a + 2 - t)) - 1 / a;
98
+ fshString +=
99
+ ' float a = alpha / (1.0 - alpha);\n' +
100
+ ' float t = sqrt(1.0 / (a * a) + vt * ( 2.0/a + 2.0 - vt )) - 1.0 / a;\n'
101
+ }
102
+ } else if (stretching.fun == 'circleInv') {
103
+ // 1 - sCircleLow(1 - t, alpha)
104
+ if (stretching.alpha == 0)
105
+ //if (alpha == 0) return t;
106
+ fshString += ' float t = vt;\n'
107
+ else if (stretching.alpha == 1)
108
+ // if (alpha == 1) return Math.sqrt(2 * t - t * t);
109
+ fshString += ' float t = 1.0 - sqrt((1.0 - vt) * (1.0 + vt));\n'
110
+ else {
111
+ //const a = alpha / (1 - alpha);
112
+ //return Math.sqrt(1 / (a * a) + (2 * t) / a + 2 * t - t * t) - 1 / a;
113
+ fshString +=
114
+ ' float a = alpha / (1.0 - alpha);\n' +
115
+ ' float t = 1.0 - sqrt(1.0 / (a * a) + (1.0-vt) * ( 2.0/a + 1.0 + vt )) + 1.0 / a;\n'
116
+ }
117
+ } else {
118
+ console.error('Unexpected stretching function code: ' + stretching.fun)
119
+ fshString += ' float t = vt;\n'
120
+ }
121
+ } else {
122
+ fshString += ' float t = vt;\n'
123
+ }
124
+
125
+ //choose initial and final colors, and adjust t value
126
+ if (colors.length == 1) fshString += ' vec4 cI=c0;\n vec4 cF=c0;\n'
127
+ else if (colors.length == 2) fshString += ' vec4 cI=c0;\n vec4 cF=c1;\n'
128
+ else {
129
+ const nb = colors.length - 1
130
+ const nbs = nb + '.0'
131
+ fshString += ' vec4 cI;\n'
132
+ fshString += ' vec4 cF;\n'
133
+ fshString += ' if(t<1.0/' + nbs + ') { cI=c0; cF=c1; t=t*' + nbs + '; }\n'
134
+ for (let i = 2; i < nb; i++)
135
+ fshString +=
136
+ ' else if(t<' +
137
+ i +
138
+ '.0/' +
139
+ nbs +
140
+ ') { cI=c' +
141
+ (i - 1) +
142
+ '; cF=c' +
143
+ i +
144
+ '; t=' +
145
+ nbs +
146
+ '*t-' +
147
+ (i - 1) +
148
+ '.0; }\n'
149
+ fshString +=
150
+ ' else { cI=c' + (nb - 1) + '; cF=c' + nb + '; t=' + nbs + '*t-' + (nb - 1) + '.0; }\n'
151
+ }
152
+
153
+ //one single color
154
+ if (colors.length == 1) fshString += ' gl_FragColor = vec4(c0[0], c0[1], c0[2], c0[3]);}\n'
155
+ //set interpolated color, between initial and final one
156
+ else fshString += ' gl_FragColor = mix(cI, cF, t);}\n'
157
+
158
+ //console.log(fshString)
159
+
160
+ /** @type {WebGLShader} */
161
+ const fShader = createShader(gl, gl.FRAGMENT_SHADER, fshString)
162
+
163
+ /** @type {WebGLProgram} */
164
+ this.program = initShaderProgram(gl, vShader, fShader)
165
+ gl.useProgram(this.program)
166
+
167
+ //set uniforms
168
+
169
+ //sizePix
170
+ //TODO: bug here. Seems to be limited to some threshold value (around 250).
171
+ gl.uniform1f(gl.getUniformLocation(this.program, 'sizePix'), 1.0 * sizePix)
172
+
173
+ //stretching alpha factor
174
+ gl.uniform1f(gl.getUniformLocation(this.program, 'alpha'), stretching ? 1.0 * stretching.alpha : 0.0)
175
+
176
+ //colors
177
+ for (let i = 0; i < colors.length; i++) {
178
+ const c = color(colors[i])
179
+
180
+ let opacity = c.opacity
181
+ if (c.opacity == 1 && globalOpacity != undefined) opacity = globalOpacity
182
+
183
+ gl.uniform4fv(gl.getUniformLocation(this.program, 'c' + i), [
184
+ +c.r / 255.0,
185
+ +c.g / 255.0,
186
+ +c.b / 255.0,
187
+ +opacity,
188
+ ])
189
+ }
190
+ }
191
+
192
+ /** */
193
+ draw(verticesBuffer, tBuffer, transfoMat) {
194
+ const gl = this.gl
195
+ const program = this.program
196
+
197
+ //vertice data
198
+ gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer())
199
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(verticesBuffer), gl.STATIC_DRAW)
200
+ const position = gl.getAttribLocation(program, 'pos')
201
+ gl.vertexAttribPointer(
202
+ position,
203
+ 2, //numComponents
204
+ gl.FLOAT, //type
205
+ false, //normalise
206
+ 0, //stride
207
+ 0 //offset
208
+ )
209
+ gl.enableVertexAttribArray(position)
210
+
211
+ //t data
212
+ gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer())
213
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(tBuffer), gl.STATIC_DRAW)
214
+ const t = gl.getAttribLocation(program, 't')
215
+ gl.vertexAttribPointer(t, 1, gl.FLOAT, false, 0, 0)
216
+ gl.enableVertexAttribArray(t)
217
+
218
+ //transformation
219
+ gl.uniformMatrix3fv(gl.getUniformLocation(program, 'mat'), false, new Float32Array(transfoMat))
220
+
221
+ // Enable the depth test
222
+ //gl.enable(gl.DEPTH_TEST);
223
+ // Clear the color buffer bit
224
+ gl.clear(gl.COLOR_BUFFER_BIT)
225
+ // Set the view port
226
+ //gl.viewport(0, 0, cg.w, cg.h);
227
+
228
+ gl.drawArrays(gl.POINTS, 0, verticesBuffer.length / 2)
229
+ }
230
+ }