Hello! I was recently able to get help on a question with p5.Geometry (here) and am back with another question:
Is it possible to use p5.Geometry to make a line drawing? In immediate mode, we can pass a parameter to beginShape()
(e.g. POINTS, LINES, TRIANGLES, TRIANGLE_FAN, etc). I see that the drawBuffers function uses webGL’s TRIANGLES
mode; is there a way to instead use LINE_STRIP
?
I’m new to webGL so let me know if this doesn’t make sense, or there some better way to accomplish a line drawing like this! Thanks!
1 Like
p5.js doesn’t expose any easy way to use WebGLs other drawing modes with p5.Geometry. However, have you tried just calling noFill()
and stroke(...)
with the color of lines that you want? I think the main difference between this and the LINES drawing mode will be the thickness of the lines (with WebGL LINES, they’ll be uniform thickness regardless of distance, with p5.js and stroke() the closer the line is to the camera the thicker the lines will be).
2 Likes
Just came back to this and saw my reply didn’t post!
Thanks for the insights @KumuPaul - I thought I had tried this but must have done it wrong, because it works! Good to learn that p5 doesn’t expose ways to use other drawing modes
1 Like