FengGUI update problem

I've written a lot of server back-end code for my game already, and I'm at the point where I need a GUI so the user can login.

I tried the example at:


and it worked well.

But I need to make this in a way where I can switch GUIs on the fly.  (ex:  go from login-screen to options screen) 

I'm keeping a reference to a single instance of an org.fenggui.Display.  When I add elements to the display, they are not shown unless I add them inside the initGame() method.  What do I need to do to get it to show new components on the fly?

Note that I do call "disp.layout();"  after I add the new components.


Solved that problem, it was that i didn't realize that  myGame.start() does not go in its own thread.

But now I have another:


at org.lwjgl.opengl.GL11.glGenTextures(GL11.java:1348)

at org.fenggui.render.lwjgl.LWJGLTexture.createTextureID(Unknown Source)

at org.fenggui.render.lwjgl.LWJGLTexture.createTexture(Unknown Source)

at org.fenggui.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.StandardWidget.setupTheme(Unknown Source)

at org.fenggui.ComboBox.<init>(Unknown Source)

at client.gui.LoginScreen.init(LoginScreen.java:46)

at client.gui.LoginScreen.<init>(LoginScreen.java:26)

at client.Sculptor.proceedToLogin(Sculptor.java:78)

at client.Sculptor$3.handle(Sculptor.java:109)

at global.Connection.run(Connection.java:127)

at java.lang.Thread.run(Unknown Source)

haha, found my answer again

from the fengui site:

I get a NullpointerException in org.lwjgl.opengl.GL11.glGenTextures!

You are probably building your GUI in a different thread than in the render thread! See this post here. The reason is that textures are uploaded in the initialization phase of certain widgets (e.g. bitmap fonts or skin textures) so that LWJGL crashes because it cannot retrieve a valid texture id.

Glad you solved it!