I’m using the HUD that ships with jme to display text for an experimental app state used for loading purposes.
When I’m finished with the app state, I invoke setEnable(false) to stop loading and remove the HUD from the scene. The loading stops and onDisable() is called, but for some reason, the HUD still appears “attached” to the scene graph.
@Override
protected void initialize(Application app) {
// initialize text
BitmapFont guiFont = app.getAssetManager().loadFont("Interface/Fonts/Operations.fnt");
BitmapText loadtext = new BitmapText(guiFont);
loadtext.setSize(guiFont.getCharSet().getRenderedSize());
loadtext.setText("Loading...");
loadtext.setLocalTranslation(app.getContext().getSettings().getWidth()/2, app.getContext().getSettings().getHeight()/2, 0);
// attach to state's local gui node
gui.attachChild(loadtext);
getSimpleApp(app).getGuiNode().attachChild(gui);
}
@Override
protected void onDisable() {
// remove gui from the scene
gui.removeFromParent();
}
Edit: Found the culprit! The FadeFilter I added to transition between scenes was somehow causing the problem, and even my Lemur gui elements were affected by it. Any idea why this is happening?
The FadeFilter is applied to the whole FrameBuffer, Lemur gui is Quads or Meshes, you will need to disable that filter when the user interacts with the GUI…
Hmm, I don’t think that is possible for me, since I have to remove things from the gui exactly when the FadeFilter must be enabled (during scene transition).
Unless, of course, I’m misunderstanding you…
Anyway, I don’t understand the description of the problem.
Sorry about that. Originally, I posted about an issue where I was unable to “remove” spatials from the gui scene graph. Only after posting did I realize that FadeFilter (which I am currently using for scene transition) is somehow causing the issue.
Is there a reason you are using the FadeFilter versus just plopping a quad over the screen and changing its alpha?
I had seen FadeFilter in the docs and assumed it was specifically designed for fading out scenes.
Sure, that’s what it was designed for. The engine has lots of shiny toys like this but they may not always be the best thing.
As to the other, I don’t know how the two are related. In my memory, the 2D GUI is completely separate from any post-processing (even if you want them to be together you can’t). I could be misremembering… but the guiNode gets its own viewport and post processing is specific to the main scene viewport.
Yeah, I don’t know how it can “somehow” be causing the issue nor do I fully understand what “the issue” is.
Maybe something is causing the backbuffer not to be cleared and the GUI stuff isn’t really still there anymore… just never cleared.