Lemur components not showing on alpha3 + swing

I’m having a problem with showing lemur components. Whatever component I add (excepting a simple panel) is not rendering. If, for example, I add a main panel (this one is showing) and I add labels inside it, the labels aren’t showing but the parent panel is getting bigger.

It was working before changing to JME3.1-alpha3. A simple test-case i:

build.gradle:

version '1.0-SNAPSHOT'

apply plugin: 'java'
apply plugin: 'application'

sourceCompatibility = 1.5

def jme_group = 'org.jmonkeyengine'
def jme_version = '[3.1,)'

mainClassName = "Main"

repositories {
    jcenter()
}

dependencies {
    compile "$jme_group:jme3-core:$jme_version"
    compile "$jme_group:jme3-lwjgl:$jme_version"
    compile "$jme_group:jme3-desktop:$jme_version"

    compile "com.simsilica:lemur:+"
    compile "com.simsilica:lemur-proto:+"

    compile 'ch.qos.logback:logback-core:+'
    compile 'ch.qos.logback:logback-classic:+'

    compile 'com.google.guava:guava:19.+'
    compile 'org.codehaus.groovy:groovy-all:2.4.+'
}

Main.java:

public class Main extends SimpleApplication {

    public static void main(String[] args) {
        AppSettings settings = new AppSettings(true);
        settings.setWidth(640);
        settings.setHeight(480);
        settings.setFrameRate(60);

        JFrame window = new JFrame();

        Main canvasApplication = new Main();
        canvasApplication.setSettings(settings);
        canvasApplication.createCanvas();

        JmeCanvasContext ctx = (JmeCanvasContext) canvasApplication.getContext();
        ctx.setSystemListener(canvasApplication);
        Dimension dim = new Dimension(750, 700);
        ctx.getCanvas().setPreferredSize(dim);

        JPanel canvasPanel = new JPanel();
        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        canvasPanel.add(ctx.getCanvas());

        window.add(canvasPanel);
        window.pack();
        window.setVisible(true);

        canvasApplication.startCanvas();
    }


    public void simpleInitApp() {
        GuiGlobals.initialize(stateManager.getApplication());
        BaseStyles.loadGlassStyle();
        GuiGlobals.getInstance().getStyles().setDefaultStyle("glass");

        Container mainWindow = new Container();
        mainWindow.addChild(new Label("--- Main Window ---"));

        Container optionsWindow = mainWindow.addChild(new Container());
        optionsWindow.addChild(new Label("Options Window"));

        mainWindow.setLocalTranslation(300, 300, 0);
        guiNode.attachChild(mainWindow);
    }
}

Any help is welcome.

Do the stats show up?

Someone on another thread suggested that JME in swing has its sort order backwards or something. I don’t use the Swing stuff and it’s not well supported in JME so I’m not sure. (I personally use the AwtPanel stuff instead.)

No, the stats aren’t showing O.O. The stats-box is there but not the text. The weird thing is that all was working until I changed to alpha3. If I manually add BitmapTexts to the guiNode it is showing it great.

The problem is that I have a lot of things done on an old swing app and I don’t really have much time to spend on it so I wanted to know if there was a fast fix to make it work without having to port all the swing stuff.

According to the other user (I only read the topic I didn’t look into it), it seems that the items are being sorted backwards back-to-front. So the reason the stats don’t show up is because the background is drawn first. Removing the stats’ background quad apparently causes the stats text to show again.

I personally have no idea what would cause that. For one thing, in a normal app, all stuff in the GUI bucket is flatted into 0 Z and the order is the only way stuff gets rendered. So there is no transparency + Z blocking issue in the GUI node… unless somehow blend mode is getting messed up. But then the stats quad would be opaque. I don’t know if @Momoko_Fan has any idea what could have changed to cause the swing apps to fail in this way.

As a simple test, you might try setting the scale on your gui node to (1, 1, -1)… I don’t know if that will cause other issues.

That just worked O.O (and it seems that there is nothing broken), what is the third value for?.

Thanks for your help :smiley: .

Each of those values scales in the axis given… so 1, 1, -1 is
scale x 1
scale y 1
scale z -1

…basically inverting z.

But, in a gui node (working on 2D) what is this doing?

Ok, nothing, I just saw that I was thinking stupidly on bad ways xD.

Z is used to sort the GUI from back to front for rendering. Since the sort order seems to be backwards when using Swing, inverting Z inverts the sort order backing backwards into backwards-barckwards which is forwards. :slight_smile: