[Solved] display statistics with the last SDK Nightly

Hi all,

We updated our JM3 to the last nightly buid and we are seeing the texture, triangles, sharder and objects are increasing …

A behaviour never see before.

Please advice and help.

check out the behavioure before and after the update.






jMonkeyEngine SDK Nightly

jMonkeyEngine3 library Version:

SDK Core Version:

SDK Library Version:

@pspeed: Sounds like your changes to the statistics?

If anything it should be even less likely to do this than before since I moved the resetting of stats right into the SimpleApplication class.

@shirion, can you tell me more about how your application is setup? Is it a standard SimpleApplication extension?

I’m going to guess:

  1. you don’t extend SimpleApplication
  2. you manually use the StatsView class in your own Application-derived app.

    Is that right?

Yes, I dont use the SimpleApplication class for my application

I directly call the “loadFpstext” and “loadStatsView” in my code.

=> I will double check with you last update in r9184

Here is my code


protected BitmapText fpsText;

protected BitmapFont guiFont;

protected StatsView statsView;

protected boolean showStat = false;

private boolean showFps = false;

protected float secondCounter = 0.0f;

protected int frameCounter = 0;

public void init(Renderer renderer){







  • Attaches FPS statistics to guiNode and displays it on the screen.



    public void loadFPSText() {

    guiFont = BBSceneManager.getInstance().getAssetManager().loadFont("Interface/Fonts/Default.fnt");

    fpsText = new BitmapText(guiFont, false);

    fpsText.setLocalTranslation(0, fpsText.getLineHeight(), 0);

    fpsText.setText("Frames per second");




  • Attaches Statistics View to guiNode and displays it on the screen
  • above FPS statistics line.



    public void loadStatsView(Renderer renderer) {

    statsView = new StatsView("Statistics View", BBSceneManager.getInstance().getAssetManager(), renderer.getStatistics());

    //move it up so it appears above fps text

    statsView.setLocalTranslation(0, fpsText.getLineHeight(), 0);



    public void update(float tpf) {

    if (showFps) {

    secondCounter += tpf;

    frameCounter ++;

    if (secondCounter >= 1.0f) {

    int fps = (int) (frameCounter / secondCounter);

    fpsText.setText("Frames per second: " + fps);

    //System.out.println("***FPS : "+ fps);

    secondCounter = 0.0f;

    frameCounter = 0;




    public boolean isShowFPS(){

    return showFps;


    public boolean isShowStat(){

    return showStat;


    public void setDisplayFps(boolean show) {

    showFps = show;

    fpsText.setCullHint(show ? CullHint.Never : CullHint.Always);


    public void setDisplayStatView(boolean show) {

    showStat = show;


    statsView.setCullHint(show ? CullHint.Never : CullHint.Always);



If you do not extend SimpleApplication then you have to manually reset the stats object at the right time.

I could probably add an app state to do this. In the mean time, you will have to manually do it in your application’s update loop. It needs to happen right before the render stuff is called but after all of the updates are called. You can look in SimpleApplication.update() to see.

Or you can add an AppState that resets the stats on render() (not update). This is what I will do to make sure direct Application-derived classes do the right thing.

Is there a reason you don’t extend SimpleApplication?

Thank for your speed response @pspeed

Your name suite you very well :slight_smile:

I added the clearFrame and all think work well




@shirion said:
Thank for your speed response @pspeed
Your name suite you very well :)

It's the name I was born with so it was bound to have an effect on me sometime! :)

I just committed code to make this call unnecessary.

It should go into tonight’s nightly.

Basically, I’ve add a ResetStatsState that is added to state manager in Application. No more having to manually clearFrame().