Events in new window

Hi,

I am trying to have multiple windows, each presenting the same scene from a different perspective. I use

base.graphicsEngine.makeOutput

to create new windows.

The problem is that the new windows being created don’t respond to mouse or Key events. Is there a way to achieve this?

Below is a sample code. Only one of the windows receives the mouse event (try rotating the camera).

import direct.directbase.DirectStart
from pandac.PandaModules import *

#Load the first environment model
environ = loader.loadModel("models/environment")
environ.reparentTo(render)
environ.setScale(0.25,0.25,0.25)
environ.setPos(-8,42,0)

props = WindowProperties.getDefault()
#props.setParentWindow(panel.GetHandle())

if not base.pipe:
    base.makeDefaultPipe()

newWindow = base.graphicsEngine.makeOutput(base.pipe, 'name', 0,
                     FrameBufferProperties.getDefault(),
                     props,
                     0,
                     gsg = base.win.getGsg())

if newWindow is None:
    print 'Warning: New Output Could not be created\n'
    

newCamera = base.makeCamera(win = newWindow, camName = 'newCam')

run()

GraphicsEngine.makeOutput just creates the window or buffer for rendering into. If you want a real window which also processes events, use the higher-level base.openWindow instead.

Thanks for the quick response!

even using

base.openWindow

doesn’t help

import direct.directbase.DirectStart
from pandac.PandaModules import *

#Load the first environment model
environ = loader.loadModel("models/environment")
environ.reparentTo(render)
environ.setScale(0.25,0.25,0.25)
environ.setPos(-8,42,0)


newWindow = base.openWindow()
#base.setupMouse(newWindow)

run()

the new window still doesn’t receive any mouse events.
If I remove the comment on the second last line

base.setupMouse(newWindow)

both the windows stop receiving events.

Is there something very obvious I am missing out here?

Regards
Shashank

Figured out!

calling

base.setupMouse

actually does the job.

It seems to be a special case with the default camera control which doesn’t work for the new window.

All the events are, however, being passed onto the new window in good shape.

Thanks for the help
Shashank