Rendering mesh with stroke effect

What is the preferred way to render a 3D mesh with a stroke effect between vertices?

for example, this seems to be built in to processing (and related frameworks). Here is an example from p5js:

function setup() {
  createCanvas(640, 360, WEBGL);
}

function draw() {
  background(0);
  orbitControl();
  stroke(255);
  strokeWeight(2.0);
  fill(80, 10, 120);
  box(150);
}

I believe OpenGL has a wireframe mode, but it only works without fill (the faces are transparent).

I think I could achieve this effect by first rendering the mesh normally and then rendering some LineSegments between the desired vertices, but I’m wondering if there is a better way.

By the way, I also tried the ContourRenderer in orx-dnk3, and it’s very cool! but not quite the same effect:

1 Like