Connect all points with lines

How do I make all the particles have lines connecting like this pen https://codepen.io/AlainBarrios/full/MzKjrO

This is what I have at the moment
https://codepen.io/AlainBarrios/pen/qzejoJ?editors=0010

You can daw array of points with gl.LINES and then another draw call with gl.POINTS

The following official three.js example might help:

https://threejs.org/examples/webgl_buffergeometry_drawrange

Study how LineSegments and Points are managed and rendered in this demo.

3 Likes

Hm, why do you ask about something you already have? :wink:

Do you want a complete graph, a graph where all nodes are connected to each other?


Source (public domain): https://en.wikipedia.org/wiki/Complete_graph#/media/File:Complete_graph_K7.svg