# vtkHardwareSelector and multi-layer rendering

**URL:** https://discourse.vtk.org/t/vtkhardwareselector-and-multi-layer-rendering/2996
**Category:** Development
**Created:** [April 9, 2020, 8:27am UTC](https://discourse.vtk.org/t/vtkhardwareselector-and-multi-layer-rendering/2996 "2020-04-09T08:27:26Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mat127](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mat127/32/255_2.png) [@mat127](https://discourse.vtk.org/u/mat127)
#### Post date: [April 9, 2020, 8:27am UTC](https://discourse.vtk.org/t/vtkhardwareselector-and-multi-layer-rendering/2996/1 "2020-04-09T08:27:27Z")

</div>

Hello,

is `vtkHardwareSelector` capable to work correctly in multi-layered rendering setup? My setup is following:

- 2 layers
- layer 0 contains all actors
- layer 1 contains widget representations and some special actors used for highlighting
- renderers of both layers share the same camera

I use the `vtkHardwareSelector` for implementation of custom picking. Regardless which of the two renderers is assigned to the selector by calling `vtkHardwareSelector::SetRenderer()` after calling `vtkHardwareSelector::CaptureBuffers()` the subsequent calls to `vtkHardwareSelector::GetPixelInformation()` return props from the renderer of layer 0 or sometimes layer 1. By default props of the layer 0 are returned even renderer 1 is assigned to selector. After some interaction within the scene and clicking on a widget representation and refresing the buffers by `vtkHardwareSelector::CaptureBuffers()` the props from layer 1 are returned suddenly but no props from layer 0. After clicking outside any widget and refreshing selector buffers again props from layer 0 are returned.

How can I control which renderer/layer is used for the `vtkHardwareSelector`? I expect that the method `vtkHardwareSelector::SetRenderer()` does this job, but it seems that it does not. Can someone please explain it?

Petr

---

<div class="post-metadata">

### Author: ![embeddedmz](https://discourse.vtk.org/user_avatar/discourse.vtk.org/embeddedmz/32/12_2.png) [@embeddedmz](https://discourse.vtk.org/u/embeddedmz)
#### Post date: [April 16, 2020, 8:33am UTC](https://discourse.vtk.org/t/vtkhardwareselector-and-multi-layer-rendering/2996/2 "2020-04-16T08:33:41Z")

</div>

@mat127 take a look of how this project [https://github.com/OpenGeoscience/vtkMap](https://github.com/OpenGeoscience/vtkMap) is using vtkHardwareSelector (file: vtkGeoMapFeatureSelector.cxx). It’s a slippy map that may contains many layers.
