Hi,
Yesterday I started (again) with JME, but now with fancy version 3.1.0-beta1. I started playing around with Lemur and thought about creating a native settings screen. But I soon ran into trouble applying the settings…
When I update some AppSettings, set them on the SimpleApplication object and calling restart(), strange stuff starts to happen. Rendering is broken, some settings are just not taken into account etc…
I created a test case to try out and added some screenshots.
Am I doing something wrong?
Applying settings before calling start(): OK
Applying settings later and called restart(): NOK Lemur gui is broken, StatsAppState is not visible anymore, …
Test case:
public class AppSettingsProblem extends SimpleApplication {
public static void main(String[] args) {
AppSettingsProblem appSettingsProblem = new AppSettingsProblem();
// this will work ok
AppSettings settings = new AppSettings(true);
settings.setSamples(8);
appSettingsProblem.setSettings(settings);
appSettingsProblem.setShowSettings(false);
appSettingsProblem.start();
}
@Override
public void simpleInitApp() {
GuiGlobals.initialize(this);
BaseStyles.loadGlassStyle();
GuiGlobals.getInstance().getStyles().setDefaultStyle("glass");
drawBox();
someLemur();
// this will not work
// AppSettings settings = getContext().getSettings();
// settings.setSamples(2);
// this.setSettings(settings);
// this.restart();
}
private void drawBox() {
Geometry geometry = new Geometry("box", new Box(1, 1, 1));
Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
material.setColor("Color", ColorRGBA.Blue);
Texture texture = assetManager.loadTexture("Textures/Monkey.png");
material.setTexture("ColorMap", texture);
geometry.setMaterial(material);
rootNode.attachChild(geometry);
}
private void someLemur() {
Container container = new Container();
container.addChild(new Label("Placeholder"));
container.addChild(new Button("Button"));
container.setLocalTranslation(new Vector3f(0, getContext().getSettings().getHeight(), 0));
getGuiNode().attachChild(container);
}
}
In the test case I just use Anti Aliasing as a sample, but other settings also cause this behaviour…
This is a case where I set gamma correction enabled before calling start().
Here I set gamma correction later on and call restart(). You can clearly see at the Lemur gui that this is not turned on.
Same issue when setting BitsPerPixel etc… (yes the resolution/refresh rate/bpp is supported by my gfx card)