Subclass vtkRenderWindow (no OpenGL support)

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

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.

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

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.