diff --git a/src/examples/dream/ts/index.ts b/src/examples/dream/ts/index.ts index 9eb18da..be7370b 100644 --- a/src/examples/dream/ts/index.ts +++ b/src/examples/dream/ts/index.ts @@ -51,15 +51,13 @@ const init = () => { const positionAttribLocation = gl.getAttribLocation(program, 'a_position'); const colorAttribLocation = gl.getAttribLocation(program, 'a_color'); + gl.clearColor(1, 1, 1, 1); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); gl.useProgram(program); - const nodeGroup = []; - for (let i = 0; i < 30; i++) { - nodeGroup[i] = [Math.random(), Math.random()] - } + const draw = (bufferArr: number[]) => { gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(bufferArr), gl.STATIC_DRAW); @@ -140,6 +138,7 @@ const init = () => { const coordinates = []; const { points, group } = defaultGroup.length > 0 ? genDelaunayPointsData(defaultGroup) : genDelaunayPointsData(); const triangles = points.triangles; + console.log(triangles, group); for (let i = 0; i < triangles.length; i += 3) { coordinates.push([ [group[triangles[i]][0], group[triangles[i]][1]], diff --git a/src/examples/dream/ts/shaders/vertex.vert b/src/examples/dream/ts/shaders/vertex.vert index 4f2a1b9..e3ea2d3 100644 --- a/src/examples/dream/ts/shaders/vertex.vert +++ b/src/examples/dream/ts/shaders/vertex.vert @@ -4,6 +4,7 @@ attribute vec2 a_position; attribute vec3 a_color ; + varying vec3 fragColor; void main(void) {