[Solved] CardMaker with multiple windows

I am trying to display a GUI on several different screens. I have it such that there are three different windows, one on the left, one in the middle, and one on the right. I need to display a picture on the left side of the left window. The way I do it right now is:

    self.leftBarCM = CardMaker("LeftBar")
    self.leftBarCM.setFrame(-0.20, 0.20, -1, 1)
    texture = loader.loadTexture("2d/bar_left.jpg")
    self.leftBar = render2d.attachNewNode(self.leftBarCM.generate())
    self.leftBar.setTexture(texture)
    self.leftBar.setPos(-0.8, 0, 0)
    self.leftBar.reparentTo(base.render2d[0]

However this only shows in the first window. How do I access the render2d for the other two windows?

There is not, by default, a render2d created for the auxiliary windows. You can create one yourself, if you like; or you can just call base.makeCamera2d(auxWin) to set up auxWin to use the standard render2d created for the main window.

David

Thanks but now it appears on all three windows when I only create one instance of the image.

Right, if you want each window to be separate, then create your own NodePath for each one, and reparent the camera for each window to that NodePath.

David

Thank you. Do you happen to know how to reparent it to aspect2d while still being on the other windows as right now it seems to be parented to just the render2d of the other windows?

You’ll need to create another aspect2d for each of the other windows also. If all you want is to maintain the aspect ratio, this can just be an ordinary node with the appropriate scale on it. If you want to have DirectGui objects that are responsive in your auxiliary windows too, it’s more complicated. See this thread for more information.

David

Thank you for the help.