diff --git a/direct/src/gui/Button.py b/direct/src/gui/Button.py index 9578dedd90..c6c3bf2444 100644 --- a/direct/src/gui/Button.py +++ b/direct/src/gui/Button.py @@ -5,7 +5,7 @@ import GuiLabel import GuiButton import Vec3 -guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node()) +guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui.node()) font = (loader.loadModelOnce("phase_3/models/fonts/ttf-comic")).node() class Button(DirectObject): diff --git a/direct/src/gui/Frame.py b/direct/src/gui/Frame.py index 8fc5b56d83..a169abb416 100644 --- a/direct/src/gui/Frame.py +++ b/direct/src/gui/Frame.py @@ -4,7 +4,7 @@ import GuiManager import GuiFrame import Vec3 -guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node()) +guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui.node()) font = (loader.loadModelOnce("phase_3/models/fonts/ttf-comic")).node() class Frame(DirectObject): diff --git a/direct/src/gui/Sign.py b/direct/src/gui/Sign.py index 47e2f46486..1354bf0bc4 100644 --- a/direct/src/gui/Sign.py +++ b/direct/src/gui/Sign.py @@ -3,7 +3,7 @@ from DirectObject import * import GuiSign import GuiManager -guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node()) +guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui.node()) class Sign(DirectObject): diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 09df3531c5..6b2f66e5b4 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -49,7 +49,6 @@ class ShowBase: self.dataRoot.node(), self.initialState) - self.render2d = NodePath(setupPanda2d(self.win)) # This is a list of cams associated with the display region's cameras self.camList = [] for camera in self.cameraList: @@ -57,6 +56,23 @@ class ShowBase: # Set the default camera self.cam = self.camera.find('**/+Camera') + # Set up a 2-d layer for drawing things behind Gui labels. + self.render2d = NodePath(setupPanda2d(self.win)) + + # Set up another 2-d layer for drawing the Gui labels themselves. + self.renderGui = NodePath(setupPanda2d(self.win)) + + # Set up an auxiliary 3-d layer for rendering floating heads + # or other 3-d objects on top of text or widgets in the 2-d + # layer. We set it up with a camera that specifically shares + # the projection with the default camera, so that when we + # change the default camera's parameters, it changes this one + # too. + self.renderAux = NodePath(NamedNode('renderAux')) + self.camAux = self.renderAux.attachNewNode(Camera('camAux')) + self.camAux.node().shareProjection(self.cam.node().getProjection()) + addRenderLayer(self.win, self.renderAux.node(), self.camAux.node()) + # We create both a MouseAndKeyboard object and a MouseWatcher object # for the window. The MouseAndKeyboard generates mouse events and # mouse button/keyboard events; the MouseWatcher passes them through