# Hardware Selector with an offscreen renderer ?

**URL:** https://discourse.vtk.org/t/hardware-selector-with-an-offscreen-renderer/11338
**Category:** Support
**Created:** [April 28, 2023, 8:51am UTC](https://discourse.vtk.org/t/hardware-selector-with-an-offscreen-renderer/11338 "2023-04-28T08:51:12Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![tbridel](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tbridel/32/7012_2.png) [@tbridel](https://discourse.vtk.org/u/tbridel)
#### Post date: [April 28, 2023, 8:51am UTC](https://discourse.vtk.org/t/hardware-selector-with-an-offscreen-renderer/11338/1 "2023-04-28T08:51:12Z")

</div>

Good morning everyone !

I am trying to pick all the cells of a poly data viewed from a camera viewpoint, and I managed to put something together with a vtkOpenGLRenderer & the vtkOpenGLHardwareSelector. When I actually render and display the output of the Renderer before calling the HardwareSelector, its output is correct and I do get the seen cells.  
In my application however, I do not need to display anything, I basically have a scene made of a camera and a polydata and I want to get the set of seen cells (view frustum + occlusion culling somehow) … using the OpenGL tools to rely on hardware acceleration would be a dream, but I cannot figure out the strategy to make it work “offscreen”.

Would anyone by any chance have any idea about this ?

Thank you very much in advance !  
Thibault

---

<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: [May 2, 2023, 2:36pm UTC](https://discourse.vtk.org/t/hardware-selector-with-an-offscreen-renderer/11338/2 "2023-05-02T14:36:22Z")

</div>

Hi @tbridel,

Offscreen rendering shouldn’t have an impact on hardware selection. As long as the offscreen FBO has the rendered image, the hardware selector just calls `glReadPixels` on it. Are you missing a `Render` call before invoking the selector?

---

<div class="post-metadata">

### Author: ![tbridel](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tbridel/32/7012_2.png) [@tbridel](https://discourse.vtk.org/u/tbridel)
#### Post date: [May 4, 2023, 8:40am UTC](https://discourse.vtk.org/t/hardware-selector-with-an-offscreen-renderer/11338/3 "2023-05-04T08:40:51Z")

</div>

Hi @sankhesh,

Thank you for your reply.  
It turns out it works indeed, the crashes I was experiencing were coming from somewhere else. For future reference, Renderer + RenderWindow with offscreen rendering + openGL hardware selector does the job !

---

<div class="post-metadata">

### Author: ![Danyuhui](https://discourse.vtk.org/user_avatar/discourse.vtk.org/danyuhui/32/5896_2.png) [@Danyuhui](https://discourse.vtk.org/u/Danyuhui)
#### Post date: [April 1, 2024, 3:39am UTC](https://discourse.vtk.org/t/hardware-selector-with-an-offscreen-renderer/11338/4 "2024-04-01T03:39:40Z")

</div>

Hello,would you please share about how to use occlusion culling in vtk?Is there a ready-made method I can use?Or you did it from scratch?Thanks for your sharing!
