Use vtkHardwareSelector to select point of vtkGlyph3DMapper

Hi,

I am using vtkGlyph3DMapper for rendering cylinders at certain points.
Now I want to click on a cylinder and get the index of the point which was clicked.

Here is my code (based on TestGlyph3DMapperCellPicking.cxx):

	virtual void OnLeftButtonDown()
	{
		vtkNew<vtkHardwareSelector> sel;
		sel->SetFieldAssociation(vtkDataObject::FIELD_ASSOCIATION_POINTS);
		sel->SetRenderer(this->Renderer);

		int event_pos_x = this->GetInteractor()->GetEventPosition()[0];
		int event_pos_y = this->GetInteractor()->GetEventPosition()[1];

		sel->SetArea(event_pos_x, event_pos_y, event_pos_x, event_pos_y);

		vtkSelection *res = sel->Select();
		
		vtkSelectionNode *glyphids = res->GetNode(0);
		if (glyphids != nullptr)
		{
			vtkAbstractArray *abs = glyphids->GetSelectionList();
			vtkIdTypeArray *ids = vtkArrayDownCast<vtkIdTypeArray>(abs);
			if(ids)
			{
				vtkIdType numSelPoints = ids->GetNumberOfTuples();
				for (vtkIdType i = 0; i < numSelPoints; i++)
				{
					vtkIdType value = ids->GetValue(i);
				}
			}
		}
	}

If I click close to the center of a cylinder I always get a value of 1, whereas a little bit off I get the right value (point index).

What’s the right way to do it?

Using vtkGlyph3D with GeneratePointIds() is not an option because I have to use
the GPU (increase performance).

Thank you!!