# vtkCellPicker::GetCellId() always returns -1?

**URL:** https://discourse.vtk.org/t/vtkcellpicker-getcellid-always-returns-1/6478
**Category:** Support
**Created:** [August 26, 2021, 10:09pm UTC](https://discourse.vtk.org/t/vtkcellpicker-getcellid-always-returns-1/6478 "2021-08-26T22:09:11Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Tomasso](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tomasso/32/5786_2.png) [@Tomasso](https://discourse.vtk.org/u/Tomasso)
#### Post date: [August 26, 2021, 10:09pm UTC](https://discourse.vtk.org/t/vtkcellpicker-getcellid-always-returns-1/6478/1 "2021-08-26T22:09:11Z")

</div>

I’m using vtkCellPicker (vtk-8.2.0, ubuntu-18.04.5) to select points in vtkPolyData, by incorporating vtkCellPicker in my class that extends vtkInteractorStyleTrackballCamera. When I create the vtk pipeline in main() following the [CellPicking.cxx example](https://kitware.github.io/vtk-examples/site/Cxx/Picking/CellPicking/), I can successfully pick cells in my vtkPolyData. Now I want to[incorporate vtk graphics into a Qt application using this approach](https://www.kdab.com/integrate-opengl-code-qt-quick-2-applications-part-2/); I’ve put the same vtk pipeline creation sequence into my class that extends QQuickFramebufferObject::Renderer. But no matter where I click in the same vtkPolyData, vtkCellPicker::GetCellId() returns -1, as does vtkCellPicker::GetClippingPlaneId(). Documentation says that -1 is returned when nothing has been selected. Otherwise the qt-vtk application seems to behave as expected. What could cause vtkCellPicker::GetCellId() to return -1?

---

<div class="post-metadata">

### Author: ![Tomasso](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tomasso/32/5786_2.png) [@Tomasso](https://discourse.vtk.org/u/Tomasso)
#### Post date: [August 31, 2021, 5:20pm UTC](https://discourse.vtk.org/t/vtkcellpicker-getcellid-always-returns-1/6478/2 "2021-08-31T17:20:32Z")

</div>

My code that bridges QT and VTK mouse button events called vtkRenderWindowInteractor::SetEventInformationFlipy(x, y, …) - hence the downstream VTK mouse handler was seeing a “flipped” y-coordinate. Thus clicks positioned over the polydata were not recognized as selected.
