Error when creating FengGUI objects

I'm getting a 'getTexture called not in OpenGL Thread!' error when I try to create a FengGUI RadioButton in one of the game states in my StandardGame.  I'm just now trying to integrate FengGUI into what I've got (which isn't a whole lot), but now that I've built FengGUI using lwjgl 2.2.2 I'm getting a lot less errors.



I'm using the current stable build of FengGUI (634), rebuilt using lwjgl 2.2.2.



I was getting a Null Pointer Exception when I tried to call 'FengGUI.createWidget(RadioButton.class);', so I put it inside of a Callable and put it in the GameTaskQueueManager.  But INSIDE of the callable, I get 'java.lang.RuntimeException: getTexture called not in OpenGL Thread!'  This is the relevant code snippet:


RadioButton<String> radioButtonTea = null;
        Future<RadioButton> radButTeaFut = GameTaskQueueManager.getManager().update(new Callable<RadioButton>() {

            public RadioButton call() throws Exception {
                RadioButton<String> radioButton = FengGUI.createWidget(RadioButton.class); <-- ERROR HAPPENS HERE
                return radioButton;
            }
        });
        try {
            radioButtonTea = radButTeaFut.get();
        } catch (Exception ex) {
            //TODO: Log this...
        }



You might recognize the radioButtonTea variable... right now I'm just trying to integrate the basic GUI from the 'integrating fenggui with jme' wiki article.  The error is this:

...
INFO: Child "skybox" attached to this node "Scene graph node"
Feb 22, 2010 4:15:21 PM class com.jme.util.GameTask invoke()
SEVERE: Exception
java.lang.RuntimeException: getTexture called not in OpenGL Thread!
        at org.fenggui.binding.render.lwjgl.LWJGLBinding.getTexture(Unknown Source)
        at org.fenggui.theme.DefaultTheme.setUp(Unknown Source)
        at org.fenggui.theme.StandardTheme.setUp(Unknown Source)
        at org.fenggui.FengGUI.setUpAppearance(Unknown Source)
        at org.fenggui.FengGUI.createWidget(Unknown Source)
        at MyGame.MyGameState$3.call(MyGameState.java:492)
        at MyGame.MyGameState$3.call(MyGameState.java:489)
        at com.jme.util.GameTask.invoke(GameTask.java:140)
        at com.jme.util.GameTaskQueue.execute(GameTaskQueue.java:111)
        at com.jmex.game.StandardGame.update(StandardGame.java:378)
        at com.jmex.game.StandardGame.run(StandardGame.java:250)
        at java.lang.Thread.run(Thread.java:619)



This doesn't make sense because I thought putting it inside that Callable made it so it was being called in the OpenGL thread...?  I'm using the same basic Callable code to create other objects like my skybox.  Any ideas?

FengGUI apparently doesn't detect whether or not it's in the OpenGL thread very well.



I edited the FengGUI source and altered org.fenggui.binding.render.lwjgl.LWJGLBinding.getTexture() so that it didn't throw an exception if it thought it wasn't in the OpenGL thread.  It creates the GUI fine now, now I just have to figure out why rendering FengGUI last still doesn't render it on top of everything…