I am attempting to put various GUI elements on the screen and I want to ensure that these GUI elements will be sorted in front of all others. The GUI elements in the front are a mixture of Buttons and OnScreenImages. The GUI elements that should remain in back of the front elements are a mixture of Buttons, OnscreenImages, and OnScreenTexts. The GUI elements are also placed either on aspect2d or render2d. I have tried setting the sortOrder to a very high number but this does not seem to consistently work.
Is there a way for me to display some GUI elements and ALWAYS make sure they will be shown in front of some other overlapping GUI elements.
There’s a “gui-popup” bin specially for that purpose:
Thanks. That seems to help very much but I am still having a problem.
self.background = DirectLabel(image='Images/pauseScreen.png', relief=None, image_scale=(1, 1, 1), image_pos=(0,0,0));self.background.reparentTo(render2d);
playImage = loader.loadModel("Images/playButton");
self.playButton = DirectButton(geom = (playImage.find('**/playButton'), playImage.find('**/playButton'), playImage.find('**/playButton'), playImage.find('**/playButton')), relief=None, command=self.Play);
self.playButton.setScale(.4, 1, .2);
self.playButton.setPos(0, 0, -.3);
quitImage = loader.loadModel("Images/quitButton");
self.quitButton = DirectButton(geom = (quitImage.find('**/quitButton'), quitImage.find('**/quitButton'), quitImage.find('**/quitButton'), quitImage.find('**/quitButton')), relief=None, command=self.Quit);
self.quitButton.setScale(.4, 1, .2);
self.quitButton.setPos(0, 0, -.7);
My OnScreenImage shows up over everything else but the two buttons that I create are not visible. I tried altering that 50 value to see if it worked but it did nothing. After looking through the documentation, it seems that the 50 value is ignored anyways unless i use ‘fixed’ instead of
What am I missing to make the buttons show up on top of my OnScreenImage?
I don’t know, you might need to call setDepthTest(False) and setDepthWrite(False).