FengGUI + TextLabel2D = annoying "white flash" (I'm in over my head)

Hey folks,



I'm using jME 2 and FengGUI (svn trunk).  I just started using the (very nice) TextLabel2D utility posted on this wiki page: 



  http://www.jmonkeyengine.com/wiki/doku.php?id=billboard_awt_label&s[]=textlabel2d



Since I added TextLabel2D, I now get an annoying "white flash" when I click on something in a FengGUI window.  To be clear:  I don't get the flash at all if I comment-out the TextLabel2D instances, the flash only occurs when I instigate FengGUI click event, and moreover I only get the flas when the TextLabel2D widgets are on-screen.



The code for TextLabel2D is on the wiki page linked above.



Here is my code for integrating FengGUI (FengGuiState extends BasicGameState):



    @Override
    public void render(float tpf) {

        // set a default TextureState, this is needed to not let FengGUI inherit
        // wrong Texture coordinates and stuff.
        Texture defTex = TextureState.getDefaultTexture().createSimpleClone();
        defTex.setScale(new Vector3f(1, 1, 1));
        TextureState defaultTextureState = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        defaultTextureState.setTexture(defTex);
        defaultTextureState.apply();
       
        fengGui.display();
        DisplaySystem.getDisplaySystem().getCurrentContext().invalidateStates();

    }

After more digging & trial-and-error than I'd be willing to admit to, this line of code seems to have cleared up the issue:



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



Here is the complete render() method from my FengGuiState, for reference:


    @Override
    public void render(float tpf) {

        // Force jME to finish rendering lest we get a "flicker" effect from jME's ORTHO queue...
        DisplaySystem.getDisplaySystem().getRenderer().renderQueue();
       
        // set a default TextureState, this is needed to not let FengGUI inherit
        // wrong Texture coordinates and stuff.
        Texture defTex = TextureState.getDefaultTexture().createSimpleClone();
        defTex.setScale(new Vector3f(1, 1, 1));
        TextureState defaultTextureState = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        defaultTextureState.setTexture(defTex);
        defaultTextureState.apply();
       
        fengGui.display();
        DisplaySystem.getDisplaySystem().getCurrentContext().invalidateStates();

    }



There's a lot in there that I don't fully understand, so please:  if you see something in there that's not quite right, let me know.

its hard to get fenggui and jme working together nicely.

i think its best if the fenggui stuff is rendered in a separate renderpass.

<— likes GBUI a lot…