Question about Frame per second

I create an application to show the model of earth. I did the basic initialization simpleInitApp() for the earth.
In another class that contains main(), I added many buttons for the interface, some of which are for the actions for example adding some points to the graph 3D to represent airports. So, I added listener for them, and in the actionPerformed(ActionEvent e) , I create another thread using canvasApplication.enqueue(new Callable<Void>(), many spheres (points ) that represent airports will be added to the rootNode.
Problem is : before adding these points to rootNode, the frame per second(fps) is about 110.
After I added the airports, fps became only 4~6 fps, application became very slow, what the problem?

Please help me, I am really not very familiar with JME.

Have you got a screenshot of the debug appstate? The vertex count, object count, triangle count etc would be useful. Some code would be good to have a look at as well.

Yes, thanks for your help.Here is the screenshot



My code for the showAllAirportButton

showAllAirportButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(showAllAirportButton.getText().equals("Show all the airports")){
					canvasApplication.enqueue(new Callable<Void>() {
						public Void call() throws Exception {
							ArrayList<Airport> listAirport = Airport.getListAirport();
							Iterator<Airport> it = listAirport.iterator();
								Airport airport =;
								float lat = (float)airport.getLatitude();
								float lon = (float)airport.getLongitude();
								canvasApplication.displayPlace(lat, lon);
							return null;
					showAllAirportButton.setText("Hide all the airports");
					canvasApplication.enqueue(new Callable<Void>() {
						public Void call() throws Exception {
							int n = Airport.getListAirport().size();
							for(int i = 1; i <= n;i ++){
							return null;
					showAllAirportButton.setText("Show all the airports");

the code to add the airport to rootNode:

public void displayPlace(float latitude, float longtitude) {
		Sphere sphere = new Sphere(16,8,0.005f);
		Geometry place = new Geometry("Town", sphere);
		Vector3f position = new Vector3f();
		position = geoCoordTo3dCoord(latitude, longtitude);
		Material mat1 = new Material (assetManager,"Common/MatDefs/Misc/Unshaded.j3md");
		mat1.setColor ("Color",ColorRGBA.Red);

the function geoCoordTo3dCoord(latitude, longtitude) is used just for transfer the coordinate of longitude and latitude to the coordinate on the earth graph.

8000 objects is a bit much, try batching the airport objects.

Excuse me, what does it mean batching?
Should I add these airports in different threads or add to different nodes?

Given you’re new to jME its probably a good idea to do the beginner tutorials and go through the documentation.

1 Like

Also putting a sphere in there is probably not needed. You can just use a point sprite for this which is much faster, see the example “TestPointSprite”


I dont think your problem is only graphics…
I think it may be related with your functions like geoCoordTo3dCoord.
Try to put those spheres in random location with out using this geo function.
Let us know if its the same.

I see that geoCoordTo3dCoord is called only when the button is pressed, so it’s not executed every frame.

I see. I just saw your fps also.
To render just a sphere, 137 is pretty slow, I am rendering a similar sphere with more then 900 fps, its to run on mobiles or machines with out video cards ?
If so, then your problem is graphics. You will need to do as Momoko said and use sprites or maybe even bether, dinamic change the texture and paint into it some points, that way you should have the same fps 137 even after you point up the aerports.

On embedded video cards this is not really surprising.

8000 objects is just too much, it would almost bring recent gamers video cards to the knees.

Yes, it runs on the ordinary PC in fact, so it’s with the video cards.
Perhaps it’s because of too much objects.I’ll try thanks

but I think it really has some connections with video cards, my friend with MAC PRO 2012 has more than 2000 fps with the same code.

The link I posted contains the direct immediate solution to your problem in three paragraphs. What is it with kids today rather spending a day to wait for a forum answer than actually reading whats suggested?

1 Like

Ah…excuse me, in fact I was just coming home without finding it.