Problem with loading an image in FengGUI


I am using FengGUI to create a HUD in my game. I want to use PixmapBackgrounds and GameMenuButtons

in my HUD-windows. But when I start the game, the HUD is displayed, but the rest of my game (textures,

lights and so on) are kind of brocken. Sometimes you cannot see anything because everything is just

white or black. When I finally spawn a player and shoot, then everything seems to "update" and looks

how it should look like. Yes, I do use updateRenderState(). I also tried to not load any Textures (don't

use PixmapBackground and GameMenuButton) and then, everything works. From the beginning everything

is drawn correctly. It seems that FengGUI has its problems with loading images in connection with

RenderStates from JME. Is this a known problem or am I the only guy who has this problem? :slight_smile:

I'm using the latest FengGUI version and JME 1.4.

I hope someone can help me. If you want to see some special code of my game, just ask :wink:

jME keeps track of some OpenGL states which FengGUI changes, and thus jME renders with a wrong TextureId or Texture scale etc. things get messy.

To make FengGUI and jME work together you need to reset some states after FengGUI is drawn and before rendering jME is rendered … or the other way around.

This can be either done in Gamestates or RenderPasses.

Thanks for you reply. I know these two links. My game builds on the way the second guide is

using FengGUI. But in this guide no textures (or GameStates or RenderPasses) are used. And

the first guide is doing this very complicated. I think if I would make it like this I had to

rewrite very much of my code. Is it really necessary to use all these classes of the first


well the first example is complicated because it uses all kind of possible error sources :slight_smile:

textures, texture scaling, transparency, terrain.

i didn't use FengGUI very much yet, but in the test cases i wrote, i aways run into some kind of problems, which only the render pass approach seems to solve.

But maybe someone else has a easier solution to your current problem.

If would be good if you can post a simple example which reproduces your problem.

So finally I got it. I split my code into some GameStates and it seems to work. But what has

to be done to make the world itself visible while the GUI is visible, too? Everytime I enable

my GUI-GameStates the rendered world gets black and I just see my GUI-Windows. How

can I make it both visible?

hmm i'm not sure, can you post a screenshot ? is it just black?

are you using render passes or just gamestates ?

The world is black, but the GUI-elements are visible. I don't know how to use RenderPasses

correctly, I tried out the code of the first FengGUI-JME-Guide, but I don't know if this suites

in my case.

EDIT: Does it depents on in which order I attach the GameStates to the GameStatesManager?

Or can someone explain me how to use RenderPasses at all? :slight_smile:

EDIT2: I found my mistake: I called DisplaySystem.getDisplaySystem().getRenderer().clearBuffers()

in update() of my GUI-GameStates. Now everything is displayed fine. Nethertheless someone

could explain me how to use these RenderPasses correctly :slight_smile: