New window & camera

Hello all,

I have a problem when opening a new window. After creating the

window, it is supposed that a new camera is created. I have reviewed
the source code and it seems it is done.

I have created a small example. When the new window
is created, nothing appears on it. I have modified the camera
attributes via camList[1] (position and orientation) and nothing
happens.

Any idea?

Thanks in advance.

Alberto

Hello all,

This is the source code:

        ...
        # Create the window
        self.propertyWindow[windowName] = base.openWindow(size=[300,300])

        # Set the new camera attributes
        base.camList[1].setPos( self.nodeSelected.getPos() )
        base.camList[1].setHpr( self.nodeSelected.getHpr() )

        self.SecondaryWindow = True

  In fact, what I am doing is to modify the scene editor in order to open a new

window when the user clicks on certain objects (pseudo-camera). But nothing
happens. I obtain a blank window.

  Another problem, I have is that the scene editor refuses to close the window

I have created, either via Tkinker or via openWindow using base.closeWindow().
I.e. this code does not work:

  # Close and remove
  base.closeWindow( self.propertyWindow[windowName] )
  del self.propertyWindow[windowName]

  Thanks in advance.

  Alberto

Try this variant:


base.openWindow(size=[300,300], gsg = base.win.getGsg())

There appear to be some issues with creating a second GSG (graphics context) on some drivers, so the above call will request that the new window uses the same GSG as the first window.

David

Hello David,

Thank you for your help. It works.
Now, it opens a new window and renders the frame using the same
camera of the main window. I have tried to move the new camera
(camList[1]) but it does not work.

What I am trying to accomsplish is to have two separate windows
with two separate views of the same scene. Is there any way to do
that?

Thanks.

Alberto

Certainly. By default, all of the cameras are parented to base.camera (so when you move base.camera, it moves all the cameras at once). This is particularly appropriate, for instance, if you are opening multiple windows to show the view out the left and right side windows of a vehicle.

If you want to move your new camera completely independently, you should change its parentage, e.g.:


base.camList[1].reparentTo(render)

David