If in example “web-project-templates-master” in
it is created two renderers is the example ready to deal with the two?
renderer2 = renderWindow.GetRenderers().GetNextRenderer()
Probably not but the framework is.
I tried to create a second renderer in server/vtkpython/vtkw-server.py
if not _Server.view:
renderer = vtk.vtkRenderer()
renderer2 = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
but the picture (triangle) do not appear in server side as in browser.
What else I must do to create a new renderer?
Maybe set the viewports, but since I have no idea why you want 2 renderers it is hard to tell. Because so far you instantiated 2 renderers and put them into the same window. So from where I stand it is a success and it is working without any error.
I want two renderers because I want to manipulate two pictures independently. (in the same window).
And it is not working with the code presented. The window of the picture comes all black.
So you need for sure to set the viewports to organize where those renderers are inside that single window. Based on the code I see, it is expected to have a black window since both of those renderers have a black background by default. So to me it is still perfectly working as it is intended.
If you want to see more than a black window, you need to start sharing more code otherwise with what is written here everything makes sense.
I have no problem to share code.
Simply, when I add one more renderer like above with nothing else the displayed picture do not appear anymore. There is anyway to put the background transparent.
renderWindow = self.getView('-1')
renderer = renderWindow.GetRenderers().GetFirstRenderer()
it give error in last line. (Besides black window)
What happen when you put two sheet of paper on top of each other? You only see the one that is on the top… Use viewport to shift them so you can put your renderers next to each other rather than on top of each other…