[vtk.js] LineWidth with vtkLineSource

I am currently unable to adjust the line width of an actor with vtkLineSource. Is there something I am missing? Are there perhaps no line cells?

(psuedo-ish code)

lineSource = vtkLineSource.newInstance();
lineActor = vtkActor.newInstance();
mapper = vtkMapper.newInstance();
lineActor.setMapper(mapper);
mapper.setInputConnection(lineSource.getOutputPort());

lineSource.setPoint1(...)
lineSource.setPoint2(...)

then try to set the line width on the actor

p = lineActor.getProperty()
p.setLineWidth(10)

and there is no observable change after re-rendering

WebGL does not support line width. Firefox may do, but the spec does not enforce that support.

Technically webgl does support line width but it is legal for a driver to set the maximum and minimum width to be 1.0 which some drivers do. So you can have wide lines as long as their width is 1.0 :slight_smile: On desktop we catch this case and convert lines to triangles which we reposition using a geometry shader etc. It is a lot of work.

1 Like