A bug of EdgeVisibilityOn in windows

Currently, I want to plot a line in image. My code is:

import vtk
from vtk.util.numpy_support import vtk_to_numpy, numpy_to_vtk
import numpy as np

def numpyToVTK(data):
    if len(data.shape) == 2:
        data = data[:, :, np.newaxis]
    flat_data_array = data.transpose(2,1,0).flatten()
    vtk_data = numpy_to_vtk(num_array=flat_data_array, deep=True, array_type=vtk.VTK_FLOAT)
    shape = data.shape

    img = vtk.vtkImageData()
    img.GetPointData().SetScalars(vtk_data)
    img.SetDimensions(shape[0], shape[1], shape[2])
    return img

img = np.zeros(shape=[512, 512])

img[0:256, 0:256] = 0
img[0:256, 256:] = 64
img[256:, 0:256] = 128
img[256:, 256:] = 255

img = numpyToVTK(img)

imgActor = vtk.vtkImageActor()
imgActor.SetInputData(img)


lineSource = vtk.vtkLineSource()
lineSource.SetPoint1(0, 0, 0)
lineSource.SetPoint2(512, 512, 0)
lineSource.Update()
lineMapper = vtk.vtkPolyDataMapper()
lineMapper.SetInputData(lineSource.GetOutput())
lineActor = vtk.vtkActor()
lineActor.SetMapper(lineMapper)
lineActor.GetProperty().SetColor(255, 0, 0)
lineActor.GetProperty().SetLineWidth(5)
# lineActor.GetProperty().EdgeVisibilityOn()     ############################ it make difference

renderer = vtk.vtkRenderer()
renderer.AddActor(imgActor)
renderer.AddActor(lineActor)
renderer.SetBackground(0.4, 0.5, 0.6)

renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer)
renderWindow.Render()
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
style = vtk.vtkInteractorStyleImage()
renderWindowInteractor.SetInteractorStyle(style)
renderWindowInteractor.SetRenderWindow(renderWindow)
renderWindowInteractor.Initialize()
renderWindowInteractor.Start()

And the result is correct:
image

However, if use lineActor.GetProperty().EdgeVisibilityOn(), I will get a incorrect result:

image

However, the ubuntu would give the same result.

My windows environment is:

win 10
python 3.7
vtk 8.1.2

Is this a bug?

I am not seeing this effect at all. Just tested on Linux and the VTK Master, NVidia graphics card.
It could be something to do with your graphics card or the old version of VTK.

This bug do not appear on linux, but it appear on win10.

Just tested on windows and I have the same result as on Linux. Windows 10, VTK Master.

Did you build VTK using OpenGL2?

I install VTK in python by: pip install vtk.
And the version of vtk is 8.1.2.

I find the result is what I expected in vtk 9.0.3.