where did the red fps overlay go??

I was seeing a redish FPS counter overlay appearing on my canvas by default, this has gone away. How do I enable/re-enable this??

Which class are you talking about?

I have been convdrting my game to the current xith3d, render loops etc. I had a redish/orange fps counter appearing in the upper right cornet of my game. i was pleased as it seemed to be default behavior of using the new stuff. Now it no longer appears.

hmm… Can’t remember, when it was default to display an FPS counter on the screen. Which version are you coming from?

But you can use the one provided by the HUD system. Have a look at org.xith3d.test.animation.RotatableGroupTest. It is used there. But please make a fresh checkout of you CVS. I’ve just moved it.

Marvin

wierd…I wonder who/what was dispalying this. I tried the HUD based one a bit ago but none of the rest of my scene appeared…I will retry

A similar issue occurs in my scene
When i put HUD on my scene the SkyBox is not displayed and when i take it off it’s displayed again, but the rest of the scene loads fine

Do you handle the multipass rendering correctly? Do it like this:


BranchGroup mainBranch = new BranchGroup();
env.addBranchGraph( mainBranch, new RenderPassConfig(RenderPassConfig.PERSPECTIVE_PROJECTION) ); // must be added before the hudBranch or with index

BranchGroup hudBranch = new BranchGroup();
env.addBranchGraph( hudBranch, new RenderPassConfig(RenderPassConfig.PARALLEL_PROJECTION) ); // must be added last or with index

// add your scene stuff to the appropriate branch
mainBranch.addChild( new Skybox( ... ) );
mainBranch.addChild( new Shape3D( ... ) );

// add your HUD stuff to the appropriate branch
hudBranch.addChild( new HUD( ... ) );

Marvin

I think I missed the render pass thing before adding the HUD…laptop died…power cords are at home. I will retyr sunday.

So depressed that the FPS thing disappered, I am seeing a 4X FPS improvement, of course this is based on the mysterious disappearing reddish FPS text. so who knows what was being measured by whom.

On a side note, I noticed all of my OLD UI based windows no longer aligh parralell to the screen, they rotate along with the view rotation…kinda cool…I assume this is a subtle push to hellp people decide to convert to the new HUD system…:slight_smile:

I don’t know the old UI system. Are you talking about the Swing overlay? Never worked with it. Again: From which version are you coming from?

I’m doing like this Marvin


    private void createSceneGraph(ExtXith3DEnvironment env, RenderPassConfigProvider passConfig, Xith3DDemoFolder demoFolder) throws Exception {
	
        // Adicona a cena ao ambiente e seta a renderização por perspectiva
        env.addChild(scene);   

        env.addRenderPass( new RenderPass(env.getRootGroup(), passConfig) );
        ...

       scene.addChild(world);
       scene.addChild(skybox);
      }

And the HUD like this


private void createHUD(ExtXith3DEnvironment env, RenderPassConfigProvider passConfig, Canvas3D canvas, Xith3DDemoFolder demoFolder) throws Exception
    {
        BranchGroup hudBranch = new BranchGroup();
        
        env.addRenderPass( new RenderPass(hudBranch, passConfig) );
        .....
       hudBranch.addChild(hud);
    }

Am i doing something wrong?

Well… First of all, never use env.addChild(), when you’re using multipass rendering. I’ll add a note on it to the JavaDoc.

The second code-quote was not complete. But I’ll assume the rest. Do it like this:


    private void createSceneGraph(ExtXith3DEnvironment env, RenderPassConfigProvider passConfig, Xith3DDemoFolder demoFolder) throws Exception {
	
	BranchGroup sceneBanch = new BranchGroup();
	
        scene.addChild(skybox);
        scene.addChild(world);
        sceneBranch.addChild( scene );
	
        env.addBranchGraph( sceneBranch, passConfig );
      }

And the HUD like this


private void createHUD(ExtXith3DEnvironment env, RenderPassConfigProvider passConfig, Canvas3D canvas, Xith3DDemoFolder demoFolder) throws Exception
    {
        BranchGroup hudBranch = new BranchGroup();
        
        env.addBranchGraph( hudBranch, passConfig );
        .....
       hudBranch.addChild(hud);
    }

Alternatively to env.addBranchGraph( BranchGroup, RenderPassConfigProvider) you can also use env.addBranchGraph( BranchGroup ) and env.addRenderPass( RenderPass) just like you did in your createHUD method. But I guess, this is easier, isn’t it?

Marvin

EDIT: I also assumed, your scene variable is not a BranchGroup. And that the RenderPassConfigProvider parameters are corretly filled with PERSPECTIVE and PARALLEL projection values.

Yup I was using the old swing overlays…I am using the most current CVS source these days.

I am not complaining by the way, it was interesting to see the same old set of windows suddenly start streching and rotating. I have been driving all day…5 hours up to the Mountains and 5 back. Had to rub my eyes several times when the windows moved… I intend to convert to the HUD stuff and drop the swing stuff.

I don’t know if i am missing something but heres is the full code


    private void createSceneGraph(ExtXith3DEnvironment env, RenderPassConfigProvider passConfig, Xith3DDemoFolder demoFolder) throws Exception {
	
        BranchGroup sceneBranch = new BranchGroup();
        
        TransformGroup world;
        
        AseFile af = new AseFile();
	BufferedReader br = null;

        try {
            br = new BufferedReader(new FileReader("src/models/Sala.ASE"));
	} catch (IOException e) {
            URL url = this.getClass().getClassLoader().getResource("src/models/Sala.ASE");
            br = new BufferedReader(new InputStreamReader(url.openStream()));
	}

        AseReader r = new AseReader(br, af);
	af.parse(r);
		
	Map<String, Node> namedNodes = new HashMap<String, Node>();
		
	world = af.getTransformGroupTree(namedNodes);
        
        scene.addChild(world);

        String top = "src/Textures/top.PNG";
        String left = "src/Textures/left.PNG";
        String back = "src/Textures/back.PNG";
        String front = "src/Textures/front.PNG";
        String right = "src/Textures/right.PNG";
        String bottom = "src/Textures/bottom.PNG";
        
        SkyBox skybox = new SkyBox(front, left, back, right, top, bottom);
        
        scene.addChild(skybox);

        AmbientLight light = new AmbientLight(true,new Color3f(0.95f, 0.95f, 0.95f));
        
        scene.addChild(light);

        sceneBranch.addChild(scene);
        
        env.addBranchGraph( sceneBranch, passConfig );
    }


    private void createHUD(ExtXith3DEnvironment env, RenderPassConfigProvider passConfig, Canvas3D canvas, Xith3DDemoFolder demoFolder) throws Exception
    {
        BranchGroup hudBranch = new BranchGroup();

        env.addBranchGraph( hudBranch, passConfig );  
        
        HUD hud = new HUD(canvas, 800, 600, this);
        
        Image crosshair = new Image(hud.getSizeOfPixels(32, 32), "src/Textures/CrosshairWhite.png", true);
        hud.addWidget(crosshair, (hud.getResolution().x - crosshair.getWidth()) / 2f, (hud.getResolution().y - crosshair.getHeight()) / 2f);

        FPSCounter fpsCounter = new FPSCounter(100, 30, "src/Textures/YellowBorder.png");
        fpsCounter.setFontColor( new Color3f(0.12f, 1.0f, 0.18f) );
        this.addFPSListener(fpsCounter);
        hud.addWidget(fpsCounter, 50, 15);        
        
        hudBranch.addChild(hud);
    }

and they are called this way


        createSceneGraph(env, new RenderPassConfig(RenderPassConfig.PERSPECTIVE_PROJECTION), demoFolder);
        createHUD(env, new RenderPassConfig(RenderPassConfig.PARALLEL_PROJECTION), canvas, demoFolder);  

If i comment the create HUD method call the skybox works fine but if it’s uncommented it dosen’t appear

ok. I checked it. And I get the same behaviour. Must be something in the multipass rendering code. I’ll fix it soon. OK?

Ok, Should you post here when you fix so i can update the cvs?

I will.

fixed.

Thanks for the help Marvin, now it’s running fine ;D

You’re welcome :slight_smile:

I use the Swing GUI and it works just fine (though I’ll convert it to the HUD when I have time to).