# Subclass vtkRenderWindow (no OpenGL support)

**URL:** https://discourse.vtk.org/t/subclass-vtkrenderwindow-no-opengl-support/13884
**Category:** Support
**Created:** [May 14, 2024, 6:39pm UTC](https://discourse.vtk.org/t/subclass-vtkrenderwindow-no-opengl-support/13884 "2024-05-14T18:39:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jens\_Munk\_Hansen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jens_munk_hansen/32/1215_2.png) [@Jens\_Munk\_Hansen](https://discourse.vtk.org/u/Jens_Munk_Hansen)
#### Post date: [May 14, 2024, 6:39pm UTC](https://discourse.vtk.org/t/subclass-vtkrenderwindow-no-opengl-support/13884/1 "2024-05-14T18:39:55Z")

</div>

Hi Developers

I am in a situation where I would like a convenience `vtkRenderView`, which is basically a `vtkRenderWindow` with two renderers, a background and a corner renderer. I use some events for ensuring that the interactor changes correctly when moving to/from the corner view. This logic, I would like to hide away.

It works flawlessly. I need to keep track also of buttons being held while cross the boundary.

Now, I would like to subclass `vtkRenderWindow` and in the same class I have arranged some static utility functions for generating “subfigures” and “mosaic” like layouts. Whenever I subclass `vtkRenderWindow` and create it from python, I get a windows where `SupportOpenGL()` is 0.

Anyone knows why I cannot simply subclass `vtkRenderWindow`. I have done this with dozen of classes before

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [May 14, 2024, 6:48pm UTC](https://discourse.vtk.org/t/subclass-vtkrenderwindow-no-opengl-support/13884/2 "2024-05-14T18:48:26Z")

</div>

Does it really need to be a subclass of `vtkRenderWindow`? You might be better of with a custom class that sets everything up.

Since you subclass `vtkRenderWindow`, you’re opting out of the factory overrides which support opengl. You might have better luck sub-classing vtk[X,Cocoa,Win32]OpenGLRenderWindow instead.

---

<div class="post-metadata">

### Author: ![Jens\_Munk\_Hansen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jens_munk_hansen/32/1215_2.png) [@Jens\_Munk\_Hansen](https://discourse.vtk.org/u/Jens_Munk_Hansen)
#### Post date: [May 14, 2024, 6:54pm UTC](https://discourse.vtk.org/t/subclass-vtkrenderwindow-no-opengl-support/13884/3 "2024-05-14T18:54:50Z")

</div>

Not really. Maybe I should use containment and simply manage a `vtkRenderWindow`, two `vtkRenderer` and `vtkInteractorStyle`. Then I can add an observer on the interactor handling the style changes. I need to make functions for installing / uninstalling the pipeline, when the user set the interactor on the ‘compound’.

Do you think this approach is better?

I would like it to be generic enough such that I can use the construct both for native and our Emscripten application

---

<div class="post-metadata">

### Author: ![Jens\_Munk\_Hansen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jens_munk_hansen/32/1215_2.png) [@Jens\_Munk\_Hansen](https://discourse.vtk.org/u/Jens_Munk_Hansen)
#### Post date: [May 14, 2024, 7:07pm UTC](https://discourse.vtk.org/t/subclass-vtkrenderwindow-no-opengl-support/13884/4 "2024-05-14T19:07:15Z")

</div>

Hi @jaswantp

I think that I will opt for a class that sets everything up and provides the possibility for setting the interactor and uninstalling an existing pipeline if necessary. I think that it is nice to hide all the functionality for keeping track of interactorstyles for the different view ports.

It is my hope that I can use it with Emscripten to keep stuff on the native side.
