# Display points and surfaces of polydata

**URL:** https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907
**Category:** Support
**Tags:** python
**Created:** [November 22, 2024, 10:00am UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907 "2024-11-22T10:00:37Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![Julien\_Champagnol](https://discourse.vtk.org/user_avatar/discourse.vtk.org/julien_champagnol/32/9415_2.png) [@Julien\_Champagnol](https://discourse.vtk.org/u/Julien_Champagnol)
#### Post date: [November 22, 2024, 10:00am UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/1 "2024-11-22T10:00:37Z")

</div>

Hi,

I’m trying to display the vertices(points) of a mesh along with the polygons with vtk from a vtp file.

This is the code I’m using :

```auto
        actor.GetProperty().SetVertexVisibility(visibility)

```

It does not change the rendering at all.

I saw the `SetRepresentationToPoints()` function but it does not seem to also display polygons.

What am I missing?  
Thanks for the help

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 22, 2024, 1:46pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/2 "2024-11-22T13:46:34Z")

</div>

Hi @Julien_Champagnol have you tried increasing the point size? `actor.property.point_size = 10`

---

<div class="post-metadata">

### Author: ![Julien\_Champagnol](https://discourse.vtk.org/user_avatar/discourse.vtk.org/julien_champagnol/32/9415_2.png) [@Julien\_Champagnol](https://discourse.vtk.org/u/Julien_Champagnol)
#### Post date: [November 25, 2024, 12:53pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/3 "2024-11-25T12:53:16Z")

</div>

> [@jaswantp](#):
>
> actor.property.point\_size = 10

Hi,

I tried this but this isn’t working :

```auto
actor.property.point_size = 10
AttributeError: 'vtkmodules.vtkRenderingOpenGL2.vtkOpenGLActor' object has no attribute 'property'

```

I’ve also tried this code :

```auto
actor.GetProperty().SetPointSize(10)

```

wich isn’t giving me any execution error but I’m not getting the desired output…

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 25, 2024, 1:51pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/4 "2024-11-25T13:51:50Z")

</div>

> [@Julien\_Champagnol](#):
>
> ```auto
> AttributeError: 'vtkmodules.vtkRenderingOpenGL2.vtkOpenGLActor' object has no attribute 'property'
> 
> ```

Okay, i didn’t know you were using old VTK.

Does the problem also occur with different mesh?

---

<div class="post-metadata">

### Author: ![Julien\_Champagnol](https://discourse.vtk.org/user_avatar/discourse.vtk.org/julien_champagnol/32/9415_2.png) [@Julien\_Champagnol](https://discourse.vtk.org/u/Julien_Champagnol)
#### Post date: [November 25, 2024, 2:31pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/5 "2024-11-25T14:31:29Z")

</div>

I also get the problem with other meshes, I’ve tried logging the point size that I just set and I get a correct programmatic output, but no correct behavior…

```auto
actor.GetProperty().SetPointSize(10)
print("GetPointSize", actor.GetProperty().GetPointSize(), flush=True)
GetPointSize 10.0

```

Also what do you mean by old version of vtk? I’m using 9.3.1 which is 4 months old?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 25, 2024, 2:42pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/6 "2024-11-25T14:42:12Z")

</div>

> [@Julien\_Champagnol](#):
>
> I also get the problem with other meshes, I’ve tried logging the point size that I just set and I get a correct programmatic output, but no correct behavior…

Okay, here’s a strange suggestion:

```py
actor.GetProperty().EdgeVisibilityOn();
actor.GetProperty().VertexVisibilityOn();
actor.GetProperty().SetPointSize(10);

```

If that works, my hunch is right. I’ve always thought there was a bug where the opengl polydata mapper only respected the vertex visibility setting when edge visibility is switched on. Let me know what you see. I think this is an easy fix.

> [@Julien\_Champagnol](#):
>
> Also what do you mean by old version of vtk? I’m using 9.3.1 which is 4 months old?

VTK 9.4 was just released a few days ago but it’s release candidates have been out for some weeks now, so I thought you were testing those wheels. One of the features in that that is you can access member variables without using the Set/Get functions.

> [@VTK 9.4.0 Release](https://discourse.vtk.org/t/vtk-9-4-0-release/14577):
>
> VTK Release Plan Starting with v9.4.0, VTK will follow a regular (calendar-based) release plan. Expect a minor release every 6 months with intermediate patch releases in between, as needed. Depending on the features added to the release, the release may become a major release. The master and release branches will split one month before the scheduled release date. Please ensure that all feature branches are merged before the split. A proposed detailed release plan will be announced a few weeks …

---

<div class="post-metadata">

### Author: ![Julien\_Champagnol](https://discourse.vtk.org/user_avatar/discourse.vtk.org/julien_champagnol/32/9415_2.png) [@Julien\_Champagnol](https://discourse.vtk.org/u/Julien_Champagnol)
#### Post date: [November 25, 2024, 2:52pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/7 "2024-11-25T14:52:36Z")

</div>

> [@jaswantp](#):
>
> If that works, my hunch is right. I’ve always thought there was a bug where the opengl polydata mapper only respected the vertex visibility setting when edge visibility is switched on. Let me know what you see. I think this is an easy fix.

I get this output but no behavior change…

```auto
GetEdgeVisibility 1
GetVertexVisibility 1
GetPointSize 10.0

```

> [@jaswantp](#):
>
> VTK 9.4 was just released a few days ago but it’s release candidates have been out for some weeks now, so I thought you were testing those wheels. One of the features in that that is you can access member variables without using the Set/Get functions.

That’s good to know, thanks for the info!

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 25, 2024, 2:54pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/8 "2024-11-25T14:54:53Z")

</div>

What’s the output of

```py
print(vtkRenderWindow().ReportCapabilities())

```

---

<div class="post-metadata">

### Author: ![Julien\_Champagnol](https://discourse.vtk.org/user_avatar/discourse.vtk.org/julien_champagnol/32/9415_2.png) [@Julien\_Champagnol](https://discourse.vtk.org/u/Julien_Champagnol)
#### Post date: [November 25, 2024, 2:57pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/9 "2024-11-25T14:57:05Z")

</div>

ReportCapabilities display id not set

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 25, 2024, 3:06pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/10 "2024-11-25T15:06:19Z")

</div>

Hi, i need more information to understand what’s causing this behavior. What does vtkRenderWindow().GetClassName() output? Whats the operating system? Do you have a physical display or is it in a headless configuration? What GPU are you using? Did you build the VTK python yourself? If so what cmake settings did you use? or is it from pypi?

---

<div class="post-metadata">

### Author: ![Julien\_Champagnol](https://discourse.vtk.org/user_avatar/discourse.vtk.org/julien_champagnol/32/9415_2.png) [@Julien\_Champagnol](https://discourse.vtk.org/u/Julien_Champagnol)
#### Post date: [November 25, 2024, 3:14pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/11 "2024-11-25T15:14:33Z")

</div>

vtk.vtkRenderWindow().GetClassName() vtkXOpenGLRenderWindow  
OS =\> Ubuntu 22.04.5 LTS  
It is physical display  
GPU =\> NV167 / Mesa Intel® Xe Graphics (TGL GT2)  
I installed it from Pypi

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 25, 2024, 3:30pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/12 "2024-11-25T15:30:57Z")

</div>

Thanks!

If i understand correctly, you’re able to render polygons and lines fine, but not points? It could be a driver issue. Can you share output of `glxinfo -B`? You can get that from `sudo apt install mesa-utils`

---

<div class="post-metadata">

### Author: ![Julien\_Champagnol](https://discourse.vtk.org/user_avatar/discourse.vtk.org/julien_champagnol/32/9415_2.png) [@Julien\_Champagnol](https://discourse.vtk.org/u/Julien_Champagnol)
#### Post date: [November 25, 2024, 3:41pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/13 "2024-11-25T15:41:03Z")

</div>

> [@Julien\_Champagnol](#):
>
> ```auto
> GetEdgeVisibility 1
> GetVertexVisibility 1
> GetPointSize 10.0
> 
> ```

Okay so there was a bug in my test suite, sorry about that… 🤦‍♂️

I get a different behavior with

```auto
actor.GetProperty().EdgeVisibilityOn()
actor.GetProperty().VertexVisibilityOn()
actor.GetProperty().SetPointSize(size)

```

But the points aren’t displayed without EdgeVisibilityOn() and VertexVisibilityOn()  
This seems to be what you talked about earlier?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 25, 2024, 3:43pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/14 "2024-11-25T15:43:23Z")

</div>

> [@Julien\_Champagnol](#):
>
> But the points aren’t displayed without EdgeVisibilityOn() and VertexVisibilityOn()  
> This seems to be what you talked about earlier?

Yup, so that confirms it.

---

<div class="post-metadata">

### Author: ![Julien\_Champagnol](https://discourse.vtk.org/user_avatar/discourse.vtk.org/julien_champagnol/32/9415_2.png) [@Julien\_Champagnol](https://discourse.vtk.org/u/Julien_Champagnol)
#### Post date: [November 25, 2024, 4:05pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/15 "2024-11-25T16:05:57Z")

</div>

Great, at least the bug is identified!  
Will this be fixed in 9.4?  
Do I need to create an issue or comment on an existing one ?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 25, 2024, 4:09pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/16 "2024-11-25T16:09:15Z")

</div>

> [@Julien\_Champagnol](#):
>
> Will this be fixed in 9.4?

Unfortunately, no. 9.4 is out the door and we cannot add any further bugfixes to it. The fix will have to go in the next release.

> [@Julien\_Champagnol](#):
>
> Do I need to create an issue or comment on an existing one ?

Yes! please create an issue at [https://gitlab.kitware.com/vtk/vtk/-/issues/new](https://gitlab.kitware.com/vtk/vtk/-/issues/new) with minimal python sample code.

---

<div class="post-metadata">

### Author: ![Julien\_Champagnol](https://discourse.vtk.org/user_avatar/discourse.vtk.org/julien_champagnol/32/9415_2.png) [@Julien\_Champagnol](https://discourse.vtk.org/u/Julien_Champagnol)
#### Post date: [November 25, 2024, 7:05pm UTC](https://discourse.vtk.org/t/display-points-and-surfaces-of-polydata/14907/17 "2024-11-25T19:05:01Z")

</div>

> [@jaswantp](#):
>
> Yes! please create an issue at [https://gitlab.kitware.com/vtk/vtk/-/issues/new](https://gitlab.kitware.com/vtk/vtk/-/issues/new) with minimal python sample code.

Done!  
[https://gitlab.kitware.com/vtk/vtk/-/issues/19540](https://gitlab.kitware.com/vtk/vtk/-/issues/19540)
