vtkSelectVisiblePoints doesn't work in QtQuick

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/ ,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?

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.

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”.

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

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).

@sankhesh Thanks,I will try it.:slight_smile: