Putting my FengGUI into a RenderPass

I've been rigging my game to use FengGUI, which seems nice.



I can't figure out how to put my FengGUI into a RenderPass, since I'm using a pass manager for all of my rendering this is a problem.



I tried this, however:

    protected void render(float interpolation)
    {
        display.getRenderer().clearStatistics();
        display.getRenderer().clearBuffers();
        GameTaskQueueManager.getManager().getQueue(GameTaskQueue.RENDER).execute();
        pManager.renderPasses(display.getRenderer());
        guidisp.display();
    }



and it gives me something like this.

I assume the passes and the guidisp.display(); aren't really getting along, so I'd like to put it into a RenderPass and just add it to my pass manager, I assume that'll probably clear up the error.

Any ideas on how to do this (I've read through the forum but all of the posts simply suggest putting it into a render pass without telling you how :))

you want to do something like




RenderPass fenPass = new RenderPass();
fenPass.add( fenDisplay);
pManager.add( fenPass );



where fenDisplay is your FenGuiSpatial

also, the fenPass should be the last pass added to your pass manager ( think this matters )

Well I would've done that except I can't find a GUI Spatial. I just have my guidisp which is a

org.fenggui.Display

I found a thread on making a class that extends Spatial, which I could then put in a render pass. I'll give that a shot. Will I have to make separate spatials for each window? It seems if it's one spatial moving one window will move all of the others?

I decided to use the advice that turns the FengGUI into a Pass instead, since I thought it would be easier to do.


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fyrestonev03;

import com.jme.image.Texture;
import com.jme.math.Vector3f;
import com.jme.renderer.Renderer;
import com.jme.renderer.pass.Pass;
import com.jme.scene.state.TextureState;
import com.jme.system.DisplaySystem;
import org.fenggui.Display;
import org.fenggui.Label;
import org.fenggui.composites.Window;

/**
 *
 * @author Tyler
 */



// This should probably extend GameState so jME can easily enable and disable
public class FengPass extends Pass {
   
   
    private Display display;

    private TextureState defaultTextureState = null;
   
    private Label fps;
   
    public FengPass() {
       
        display = new org.fenggui.Display( new org.fenggui.render.lwjgl.LWJGLBinding() );

        // Create default texture state to reset from jME to fengGUI
        Texture defTex = TextureState.getDefaultTexture().createSimpleClone();
        defTex.setScale( Vector3f.UNIT_XYZ.clone() );
        defaultTextureState = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        defaultTextureState.setTexture( defTex );

        Window fpsMonitor = new Window();
        fpsMonitor.setTitle("FPS Monitor");
        fpsMonitor.setX(15);
        fpsMonitor.setY(15);
        fpsMonitor.setSize(300,100);
        fpsMonitor.setExpandable(false);
        fpsMonitor.setShrinkable(false);
        fpsMonitor.setVisible(true);
        fps = new Label();
        fps.setText("LOADING FPS MONITOR");
        fps.setSize(fps.getMinHeight(), 150);
        fpsMonitor.addWidget(fps);
        fps.setX(25);
        fps.setY(25);
       
        display.addWidget(fpsMonitor);
        display.layout();
    }
   
    // jME State Methods
    @Override
    public void doUpdate( float timePerFrame ) {
    }
   
    @Override
    public void doRender( Renderer renderer ) {
        defaultTextureState.apply();
        display.display();
    }
   
    @Override
    public void cleanUp() {
    }
   
    public void setFPSLabelText(String s)
    {
        fps.setText(s);
    }
   
           
    public Display getDisplay()
    {
        return display;
    }
   
}



Doesn't work, though. The exact same as before. I would attempt to set it to Ortho mode to see if it fixes anything, but I wouldn't really know how to do that, especially in a Pass.