trame: multiple renderers/renderWindow

Hi all,

I have some doubts about how to handle multiple view of the same file (in local rendering). For example, I wanted to have two different views of the same object side by side (organized with vuetify row/cols). I wrote this code:

camera_1 = vtkCamera()
camera_1.SetPosition(.........)
camera_1.SetFocalPoint(.........)
camera_1.SetViewUp(.........)
camera_1.SetParallelScale(.........)


camera_2 = vtkCamera()
camera_2.SetPosition(.........)
camera_2.SetFocalPoint(.........)
camera_2.SetViewUp(.........)
camera_2.SetParallelScale(.........)

ren_1 = vtkRenderer()
ren_1.SetActiveCamera(camera_1)
ren_2 = vtkRenderer()
ren_2.SetActiveCamera(camera_2)

renWin_1 = vtkRenderWindow()
renWin_1.AddRenderer(ren_1)
renWin_1.SetWindowName("First")

renWin_2 = vtkRenderWindow()
renWin_2.AddRenderer(ren_2)
renWin_2.SetWindowName("Second")

iren_1 = vtkRenderWindowInteractor()
iren_1.SetRenderWindow(renWin_1)

iren_2 = vtkRenderWindowInteractor()
iren_2.SetRenderWindow(renWin_2)

mapper = vtkDataSetMapper()
mapper.SetInputConnection(reader.GetOutputPort())

actor = vtkActor()
actor.SetMapper(mapper)

ren_1.AddActor(actor)
ren_2.AddActor(actor)

Then in trame definition:

with SinglePageWithDrawerLayout(server) as layout:
    layout.title.set_text("Test")
    with layout.content:
        with vuetify.VRow(classes="fill-height"):   
            with vuetify.VCol(cols = 6):
                view = vtk.VtkLocalView(renWin_1)
            with vuetify.VCol(cols = 6):
                view = vtk.VtkLocalView(renWin_2)

But I obtain the same view in each one. Sometimes with the first camera position, sometimes with the second one (it seems to depend on the fact that I added some code, even unrelated to render definition. Strange behaviour…)

Is this the right way to manage this problem? Or am i doing something wrong?

Thanks

Local rendering currently has an issue with multiple views. Nothing too bad to fix it but I needs to find the time. Hopefully the holiday break will be enough.

I might have fixed it with trame-vtk==2.0.10. You can find that example that test and use multiple views.

1 Like

Thank you Sebastien. I will look into in a few days

1 Like