# vtkSelectVisiblePoints doesn't work in QtQuick

**URL:** https://discourse.vtk.org/t/vtkselectvisiblepoints-doesnt-work-in-qtquick/10006
**Category:** Support
**Created:** [November 29, 2022, 9:50am UTC](https://discourse.vtk.org/t/vtkselectvisiblepoints-doesnt-work-in-qtquick/10006 "2022-11-29T09:50:37Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![claude](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/0ea827/32.png) [@claude](https://discourse.vtk.org/u/claude)
#### Post date: [November 29, 2022, 9:50am UTC](https://discourse.vtk.org/t/vtkselectvisiblepoints-doesnt-work-in-qtquick/10006/1 "2022-11-29T09:50:37Z")

</div>

Hi everyone,  
I get a problem that vtkSelectVisiblePoints doesn’t work in QQuickVTKRenderItem+QQuickVTKRenderWindow. I refer to following link: [https://kitware.github.io/vtk-examples/site/Cxx/PolyData/SelectVisiblePoints/](https://kitware.github.io/vtk-examples/site/Cxx/PolyData/SelectVisiblePoints/) ,and implement it in qml.But it can’t get the right points which are really seen.Through debugging, I found that vtkSelectVisiblePoints could not obtain the correct ZbufferData.What should i do?

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [November 30, 2022, 3:14am UTC](https://discourse.vtk.org/t/vtkselectvisiblepoints-doesnt-work-in-qtquick/10006/2 "2022-11-30T03:14:52Z")

</div>

As long as you’re calling `vtkSelectVisiblePoints::Update` in the `sync` function of QQuickVTKRenderItem, you should be good. See the note about the [threaded render loop in the QQuickVTKRenderWindow documentation](https://vtk.org/doc/nightly/html/classQQuickVTKRenderWindow.html#details).

---

<div class="post-metadata">

### Author: ![claude](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/0ea827/32.png) [@claude](https://discourse.vtk.org/u/claude)
#### Post date: [November 30, 2022, 8:46am UTC](https://discourse.vtk.org/t/vtkselectvisiblepoints-doesnt-work-in-qtquick/10006/3 "2022-11-30T08:46:01Z")

</div>

I have tried what you said(put the vtkSelectVisiblePoints::Update in QQuickVTKRenderItem::sync function),but vtkSelectVisiblePoints gets all the points in the current viewport (although some points are obscured by other polydata).It is still unable to judge whether the point is obscured.  
And when i run in debug, i get the error message that “In vtkOpenGLState.cxx,line 68: Error in cache state for GL\_DEPTH\_WRITEMASK”.

---

<div class="post-metadata">

### Author: ![claude](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/0ea827/32.png) [@claude](https://discourse.vtk.org/u/claude)
#### Post date: [December 2, 2022, 2:13am UTC](https://discourse.vtk.org/t/vtkselectvisiblepoints-doesnt-work-in-qtquick/10006/4 "2022-12-02T02:13:40Z")

</div>

@sankhesh Could you please take a moment to help with this problem? I don’t know if I have described the problem clearly.

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [December 2, 2022, 2:36am UTC](https://discourse.vtk.org/t/vtkselectvisiblepoints-doesnt-work-in-qtquick/10006/5 "2022-12-02T02:36:12Z")

</div>

The error you’re getting indicates that the depth buffer cannot be accessed with vtk for the QtQuick context. Try looking at the depth buffer size in the QQuickWindow’s surface format. If there is a depth buffer, somewhere some code is calling `glDepthMask(GL_FALSE)`.

---

<div class="post-metadata">

### Author: ![claude](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/0ea827/32.png) [@claude](https://discourse.vtk.org/u/claude)
#### Post date: [December 2, 2022, 8:20am UTC](https://discourse.vtk.org/t/vtkselectvisiblepoints-doesnt-work-in-qtquick/10006/6 "2022-12-02T08:20:28Z")

</div>

@sankhesh Thanks,I will try it.🙂
