Two renderers

Dear All,

If in example “web-project-templates-master” in

@exportRpc("vtk.initialize")
def createVisualization(self):

it is created two renderers is the example ready to deal with the two?

And

renderer2 = renderWindow.GetRenderers().GetNextRenderer()

works?

Thanks,

Luís Gonçalves

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()
        renderWindow.AddRenderer(renderer)
        renderWindow.AddRenderer(renderer2)
        renderWindowInteractor = vtk.vtkRenderWindowInteractor()
        renderWindowInteractor.SetRenderWindow(renderWindow)
        renderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()
        renderWindowInteractor.EnableRenderOff()
        self.getApplication().GetObjectIdMap().SetActiveObject("VIEW", renderWindow)

but the picture (triangle) do not appear in server side as in browser.

What else I must do to create a new renderer?

Thanks,

Luís Gonçalves

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.

In vtk_protocol.py

@exportRpc("vtk.initialize")
def createVisualization(self):
    renderWindow = self.getView('-1')
    renderer = renderWindow.GetRenderers().GetFirstRenderer()
    renderer2=renderWindow.GetRenderers().GetNextRenderer()

it give error in last line. (Besides black window)

Thanks,

Luis Gonçalves

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…