fengGui gamestate always renders on bottom

I've been trying to add a fenggui game state to my project and it works fine, but renders under the other game state. I have tried adding the fenggui gamestate first and last, and it doesnt change. not sure what else to try



My IngameGameState extends CameraGameState.



    private void initGameStates()
    {
        // Make sure the Main GameState gets created inside the OpenGL Thread.
        try
        {
            GameTaskQueueManager.getManager().render(new Callable<Object>()
            {
                public Object call() throws Exception
                {
                    IngameGameState ingameGameState = new IngameGameState();
                    ingameGameState.setActive(true);
                    GameStateManager.getInstance().attachChild(ingameGameState);
                   
                    return null;
                }
            }).get();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }

       
        // Make sure the FengGUI GameState get created inside the OpenGL Thread.
        try
        {
            GameTaskQueueManager.getManager().render(new Callable<Object>()
            {
                public Object call() throws Exception
                {
                    GUIGameState guiGameState = new GUIGameState();
                    guiGameState.setActive(true);
                    GameStateManager.getInstance().attachChild(guiGameState);
                    return null;
                }
            }).get();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

It doesn't render after because you need to flush the queue, call Renderer.renderQueue() after the first pass finishes.

sorry, I'm still kind of new and not sure what you mean by that, or where it should be called

You have an InGameState and a GUIGameState, you need to put the statement:

DisplaySystem.getDisplaySystem().getRenderer().renderQueue();

After all your code in the InGameState render method.

Momoko_Fan said:

You have an InGameState and a GUIGameState, you need to put the statement:
DisplaySystem.getDisplaySystem().getRenderer().renderQueue();
After all your code in the InGameState render method.


You mean at the end of IngameGameState's update method? I am not sure what you mean by "After all your code".

I tried putting DisplaySystem.getDisplaySystem().getRenderer().renderQueue() in a couple places and it does not look any different.

If you know of any examples of this that you could point me to, that would be perfect


thanks

You need to flush the queue at the end of your IngameGameState render method. The FengGUI GameState needs to be added after the IngameGameState. If this doesn't work, try clearing the Zbuffer after rendering (in IngameGameState.render) with Renderer.clearZBuffer, then it SHOULD work if the GameStates are rendered in the correct order.

I also came across this: http://www.jmonkeyengine.com/wiki/doku.php?id=fenggui_jme_appl_using_standardgame

Don't like it much because it creates some garbage in the render method to reset the texture state and the matrix…

There should be some better examples using GameStates and Passes to draw FengGUI stuff.

I don't have much experience with it, so i just created the example with what i know and it seems to work at least.

But its really creating a lot of garbage thats true :slight_smile:

ok, i added renderQueue to the end of my render class and that corrected the order issue.



One thing though, CameraGameStateDefaultCamera has its render method set as final, so i had to remove that for this to work. That seems like an issue.



thanks for the help

@core-dump I have only seen your example for using standardgame, gamestates and fenggui

thats why i said there should be more examples, it would be nice if there were more/better/more complex examples :slight_smile:

it seems that fenggui is causing problems with my terrain…



http://www.jmonkeyengine.com/jmeforum/index.php?topic=7720.0