# A bug of EdgeVisibilityOn in windows

**URL:** https://discourse.vtk.org/t/a-bug-of-edgevisibilityon-in-windows/6237
**Category:** Support
**Created:** [July 24, 2021, 12:17pm UTC](https://discourse.vtk.org/t/a-bug-of-edgevisibilityon-in-windows/6237 "2021-07-24T12:17:58Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [July 24, 2021, 12:17pm UTC](https://discourse.vtk.org/t/a-bug-of-edgevisibilityon-in-windows/6237/1 "2021-07-24T12:17:58Z")

</div>

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

```auto
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](https://discourse.vtk.org/uploads/default/original/2X/4/463c2530871a9a5edb6f023259c38a261e76ea64.png)

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

![image](https://discourse.vtk.org/uploads/default/original/2X/1/1d22932dc2662d7cf7f52559a513f3c3e29ae260.png)

However, the ubuntu would give the same result.

My windows environment is:

```auto
win 10
python 3.7
vtk 8.1.2

```

Is this a bug?

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [July 27, 2021, 7:28am UTC](https://discourse.vtk.org/t/a-bug-of-edgevisibilityon-in-windows/6237/2 "2021-07-27T07:28:36Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [July 27, 2021, 12:21pm UTC](https://discourse.vtk.org/t/a-bug-of-edgevisibilityon-in-windows/6237/3 "2021-07-27T12:21:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [July 28, 2021, 12:41am UTC](https://discourse.vtk.org/t/a-bug-of-edgevisibilityon-in-windows/6237/4 "2021-07-28T00:41:58Z")

</div>

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

Did you build VTK using OpenGL2?

---

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [July 29, 2021, 12:05pm UTC](https://discourse.vtk.org/t/a-bug-of-edgevisibilityon-in-windows/6237/5 "2021-07-29T12:05:09Z")

</div>

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.
