import vtk
src = vtk.vtkCylinderSource()
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(src.GetOutputPort())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().EdgeVisibilityOn()
actor.GetProperty().SetLineWidth(5)
actor.GetProperty().SetOpacity(0.5)
ren = vtk.vtkRenderer()
ren.AddActor(actor)
ren.SetBackground(0.1, 0.2, 0.4)
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.SetSize(500, 500)
#print(renWin.GetScreenSize()) # THIS SEG FAULTS in ubuntu
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
iren.Initialize()
#iren.Start() # need this to see it rotating in OSX
for i in range(180):
iren.Render()
ren.GetActiveCamera().Azimuth(1)
iren.Start()
one can see thin lines which should not be there.
the renWin.GetScreenSize() causes either segmentation fault (ubuntu), or this output error depending on the machine:
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 38 (X_QueryPointer)
Resource id in failed request: 0x5e00002
Serial number of failed request: 188
Current serial number in output stream: 188
on OSX (Monterey) the cylinder is not rotating at all, only the final rendering is shown, unless Start() is called.
Ah, okay. I also see a crash on window close if I uncomment the GetScreenSize() line. That crash occurs for both 9.0 and 9.1. Must be a resource allocation/deallocation error or something similar. Stack trace shows the crash occurs while X11 is waiting for events:
#0 0x00007ffff17679b4 in xcb_poll_for_event () from /lib/x86_64-linux-gnu/libxcb.so.1
#1 0x00007ffff17c156e in ?? () from /lib/x86_64-linux-gnu/libX11.so.6
#2 0x00007ffff17c16ed in ?? () from /lib/x86_64-linux-gnu/libX11.so.6
#3 0x00007ffff17c19ea in _XEventsQueued () from /lib/x86_64-linux-gnu/libX11.so.6
#4 0x00007ffff17b3211 in XPending () from /lib/x86_64-linux-gnu/libX11.so.6
#5 0x00007ffff18f5dc7 in vtkXRenderWindowInteractor::StartEventLoop (this=<optimized out>) at VTK/Rendering/UI/vtkXRenderWindowInteractor.cxx:272
#6 0x00007ffff3cd114d in PyvtkRenderWindowInteractor_Start (self=<optimized out>, args=<optimized out>) at VTK-build/CMakeFiles/vtkRenderingCorePython/vtkRenderWindowInteractorPython.cxx:249
#7 0x00007ffff7ab3667 in ?? () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#8 0x00007ffff7ab3afb in _PyObject_MakeTpCall () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#9 0x00007ffff787fdf3 in ?? () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#10 0x00007ffff7887ef6 in _PyEval_EvalFrameDefault () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#11 0x00007ffff79d5ecb in _PyEval_EvalCodeWithName () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#12 0x00007ffff79d6252 in PyEval_EvalCodeEx () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#13 0x00007ffff79d663f in PyEval_EvalCode () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#14 0x00007ffff79970dc in ?? () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#15 0x00007ffff7998a47 in PyRun_SimpleFileExFlags () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#16 0x00007ffff7979558 in Py_RunMain () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#17 0x00007ffff7979aa7 in Py_Main () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#18 0x00007ffff7da88cb in vtkPythonInterpreter::PyMain (argc=<optimized out>, argv=0x7fffffffdfa8) at VTK/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx:554
#19 0x00005555555552ff in main (argc=2, argv=0x7fffffffdfa8) at VTK/Wrapping/Python/vtkPythonAppInit.cxx:110
I created a bug report (#18372) for the X11 crash. A work-around is to not call renWin.GetScreenSize() until after iren.Initialize().
The ghostly diagonals look similar to the ones reported in #18064, but that report was against VTK 9.0, not VTK 9.1. @cory.quammen are there other known issues with EdgeVisibilityOn()?