setDisplayFps and setDisplayStatView doesn't work

Hello, new JMonkeyEngine user here! :wink:

This engine is what I was looking for-easy, but powerful. But, I found out that setDisplayFps and setDisplayStatView properties doesn’t even exists in com.jme3.app.SimpleApplication. Why is that? Is it somewhere else now? Any info would be appreciated! I’m using JMonkeyPlatform Alpha-4.

http://hub.jmonkeyengine.org/javadoc/com/jme3/app/SimpleApplication.html#setDisplayFps(boolean)



http://hub.jmonkeyengine.org/javadoc/com/jme3/app/SimpleApplication.html#setDisplayStatView(boolean)



…so you may have to provide more information. I use these all the time and they certainly exist.

Don’t remember when I added those methods, but it might be after alpha 4, so you’ll have to update to nightly builds to have them.

You can find information on how to do that here update_center :: jMonkeyEngine Docs

Yeah, missed it by days…



Your change was on Mar 17, 2011 while it looks like alpha 4 went live on Mar 13.

Ok, thanks for that information. I updated to latest nightly build. There are now these procedures, but they don’t work. When compiling, it throws:



Exception in thread “main” java.lang.NullPointerException

at com.jme3.app.SimpleApplication.setDisplayFps(SimpleApplication.java:265)

at mygame.Main.main(Main.java:42)

Java Result: 1



I think I will revert to stable, because I can have these stats displayed for now.

You cannot call any of them from main(). You must call those kinds of things from simpleInit(). In fact, when in doubt, call it from simpleInit(). :slight_smile:

Ok, I got it working :slight_smile:

But I found that libbulletjme still isn’t built for Linux x86.

Is there a way to disable the output that shows matrixes? Because in stable it wasn’t visible. I’m talkng about:

Matrix4f

[

0.003125 0.0 0.0 -1.0

0.0 0.004166667 0.0 -1.0

0.0 0.0 0.0 0.0

0.0 0.0 0.0 1.0

]

Matrix4f

[

0.003125 0.0 0.0 -1.0

0.0 0.004166667 0.0 -1.0

0.0 0.0 0.0 0.0

0.0 0.0 0.0 1.0

]

In the log console

I also need to use setDisplayStatView.

I updated my JME3 alpha 4 to recognise this instruction, and place it in the simpleInitApp. But it did not work, it throws this error:

GRAVE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.NullPointerException

at mygame.Main.simpleInitApp(Main.java:115)

at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:223)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:124)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:200)

at java.lang.Thread.run(Thread.java:662)



I work in MS Windows 7

What does this line say?:

at mygame.Main.simpleInitApp(Main.java:115)



That is where the null is.

I have the latest build and I am unable to access setDisplayStatView() from anywhere (including simpleInitApp. Is there a solution to this problem? As far as I can see on my computer, the method is nowhere to be found.



Any information on this issue would be great. Thank you.

I think you don’t have the latest build, read the manual on updating to nightly.

Gasher, I finally solved the problem by not usinf simpleAplication, but extending Aplication.

I made the upgrade following the instructions, but the problem is not that setDisplayStatView is not recognised, is thet the program hangs in that instruction.

Nevertheless, the problem is solved, and at the moment I am not missing simpleAplication.

SIGH

I don’t know… what’s wrong with people? (In this case me…) I have no idea why I just did’nt decide to go nightly builds immediately when I saw it in this thread. Maybe it was a fear of breaking my game project. I don’t know… Aaaaaanyways, things are back to normal and I can use setDisplayStatView just fine. Even when extending SimpleApplication.



Tyvm for the assistance.

I got the same problem still



Exception in thread “main” java.lang.NullPointerException

at com.jme3.app.SimpleApplication.setDisplayStatView(SimpleApplication.java:277)

at BasicGame.Game.main(Game.java:34)

Java Result: 1



BasicGame.Game.main(Game.java:34) says

app.setDisplayStatView(true);



But app.setShowSettings(false); works? Why is that?



[java] public static void main(String[] args){

AppSettings settings = new AppSettings(true);

settings.setResolution(800,600);

settings.setFrameRate(60);



Game app = new Game();

app.setSettings(settings);

app.setShowSettings(false);

app.setDisplayStatView(true);

app.start();

}[/java]

You can’t call that from main. You have to call it from simple init.

@jmarco2000 said:
Gasher, I finally solved the problem by not usinf simpleAplication, but extending Aplication.
I made the upgrade following the instructions, but the problem is not that setDisplayStatView is not recognised, is thet the program hangs in that instruction.
Nevertheless, the problem is solved, and at the moment I am not missing simpleAplication.


Don't use Application. _ALWAYS_ use SimpleApplication. If you have a problem with it then figure it out. Otherwise, it's the equivalent of saying "hmm... I can't figure out how to work the windows on my car so I think I'll walk."

If you use Application then there will be a dozen things you have to do for yourself and make sure to do them absolutely right and it's just not worth the trouble.

I could have helped you with your original problem but you never answered my question that I could see.

If you have:
@jmarco2000 said:
I also need to use setDisplayStatView.
I updated my JME3 alpha 4 to recognise this instruction, and place it in the simpleInitApp. But it did not work, it throws this error:
GRAVE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at mygame.Main.simpleInitApp(Main.java:115)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:223)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:124)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:200)
at java.lang.Thread.run(Thread.java:662)


These are the _easiest_ types of exceptions to debug. Just let us know what line Main.java:115. It has nothing to do with setDisplayStatsView but some line of your code has a null pointer exception.

Or I see that the quoted post was really old now so maybe you’ve already fixed it. Still, extending Application directly is a really bad practice.

You are the app. You call it like:

setShowStatView(false) without the app. part.



app.setShowSettings() HAS to be called before you start the application or it doesn’t make any sense… because the app needs to know whether to pop-up the settings dialog or not.



Everything else requires that the application has already been started. For example, you cannot turn of stats text that doesn’t exist yet… so the application has to at least be partially initialized first.

Ok, thanks that worked. It still confuses me but I am also new to Java :slight_smile:

@pspeed said:
Don't use Application. _ALWAYS_ use SimpleApplication. If you have a problem with it then figure it out. Otherwise, it's the equivalent of saying "hmm... I can't figure out how to work the windows on my car so I think I'll walk."

If you use Application then there will be a dozen things you have to do for yourself and make sure to do them absolutely right and it's just not worth the trouble.


Thanks pspeed.
Yes, it has been some time since I post the question, but I still I am working in the application by extending Application. But I realize of my lack of knowledge, so I will focus next weeks on recode the application to use “Simple application” and follow your instructions. My 3D scene is really very simple BTW, so at the moment I am not having any problem with “Application”, but I think you are right and I should look for solve the problem and not just avoid it.

Thanks!