using vtkLabeledContourMapper got error message “Error must have verts, program and vao”

hello! I was tring to use vtkLabeledContourMapper to show the contour line and label. But when I run my code, I got a message window shows that “Error must have verts, program and vao”. My code is shown as below.

I knew that there is no OpenGL program when vtk trying to draw the label triangles. But I just don’t know how to fix this. Is there anything else I need to config in the vtkLabeledContourMapper?

having same problem here

@avilia60 I finded out why. It’s because in vtkLabeledContourMapper, if the contour line only contain 2 points, the mapper will not place labels in between the contour line. I tried to feed the vtkContourFilter output to vtkStripper, then use the vtkStripper output to vtkLabeledContourMapper, problem solved.

1 Like

Thank you so much, that really helped.