官术网_书友最值得收藏!

Time for action – checking vital stats

The com.jme3.app.StatsView UI element provides various counts, which it gathers using com.jme3.renderer.Statistics:

  1. Run the BasicGame template once more.
  2. Look at the statistics on the bottom left-hand side; they display the object counts for the various elements.
  3. Have a look at the bottom number in the HUD. It displays the frames per second (FPS).

To interpret the numbers correctly, consider that the 14 lines of text themselves already count as 14 objects with 914 vertices.

What just happened?

The StatsView window displays internal info about Textures, FrameBuffers (rendering surfaces), and Shaders (effects). The three values tell you how many are in memory (M), how many were used in the last frame (F), and how many were switched during the last frame (S).

During the development phase, keep an eye on these statistics because they can warn you about performance issues:

  • If Textures (S) is significantly higher than Textures (F), you know you are using textures inefficiently (for example, there are too many transparent ones).
  • If any (M) value is significantly higher than its (F) counterpart, then you have more objects of this type in memory than you are actually using. Determine which ones to deallocate.
  • If a small scene with a few models has tens of thousands of triangles, you need to get rid of some high-polygon objects in the scene. The hard limit for the slowest current graphics card is around 100,000 vertices per scene. 10,000 to 50,000 vertices is a typical value.
  • If your FPS stays below 30 frames or any counts are steadily increasing, you are looking at, for example, suboptimal loops or a memory leak. This should never happen in the final release.

In general, verify that the numbers are plausible for your scene.

Tip

For releases, or when you take screenshots, you will want to deactivate these StatView HUDs. To switch off the statistics and FPS views, use the following commands:

setDisplayFps(false);
setDisplayStatView(false);
主站蜘蛛池模板: 五家渠市| 醴陵市| 博爱县| 北宁市| 肃南| 香港| 大埔区| 罗城| 龙门县| 衡南县| 红安县| 呼玛县| 金山区| 门头沟区| 文山县| 安阳市| 扎赉特旗| 长海县| 武乡县| 西吉县| 城口县| 交口县| 泸州市| 家居| 桦川县| 焦作市| 兴仁县| 固阳县| 西平县| 中西区| 霍林郭勒市| 沙河市| 盐边县| 涡阳县| 日喀则市| 行唐县| 卓资县| 兴城市| 喀喇沁旗| 安远县| 土默特左旗|