I’m trying to display multiple windows. To this end, I open a second window using this snippet:
win = self.openWindow(
type='onscreen', keepCamera=False, makeCamera=False)
self.graphicsLens.setAspectRatio(self.getAspectRatio(win))
self.makeCamera(win, camName='grapĥics', lens=self.graphicsLens)
camera2d = self.makeCamera2d(win)
self.setupMouse(win, fMultiWin=False)
dr = win.makeDisplayRegion()
dr.setCamera(camera2d)'
Additionally, I have overloaded windowEvent
method in order to call self.graphicsLens.setAspectRatio(self.getAspectRatio(win))
for any window not being the main one.
Everything it is not working fine, as long as the aspect ratio is the same for both window. However, as soon as it changes, only the latest window resized display properly when the camera is moved around the scene. Then if I resize the other one, the behavior is the same but reversed. I cannot attach pictures to illustrate this behavior because I don’t have the right to do so, but in practice the ground, the grid and position of the bodies are wrong, and in some cases even their respective positions are corrupted, making the model looks dislocated.
N.B.: I’m trying the resize a offscreen window, but setSize
is raising an exception. To get around this limitation, I’m doing
self.closeWindow(self.win, keepCamera=False)
self.win = self.openWindow(
type='offscreen', keepCamera=True, makeCamera=False,
size=(width, height))
Is this the right way to do it ? Note that I’m doing it very seldomly.