This is a sign that your scene is completely messed up. That’s why we recommend a smaller number because usually the people who want to render 5000 objects (ie: 5000 separate draw dispatch round trips to the GPU per frame) have done something very wrong.
In my experience, you can use 2,000 to 5,000 objects, provided you are using decent computer hardware (what would typically be considered a gaming machine).
While the code in the tutorial is fine, it cannot be used to create this amount of lines. Apparently the author never thought of creating more than a dozen of lines, so he did not over-optimise it for clarity. If you are to create hundreds of lines, then the best way would be to put them all into a single Geometry and use a single material. You can modify the Geometrys vertex position buffer to manipulate the lines. I would suggest you to look at the custom mesh tutorial and examine the code of ParticleEmitter.
Depends on your needs. If you want a more wireframe-like behavior, you can use one of the Line* modes. Or you could just go with quads and use the standard Triangles mode (a quad is made of 2 triangles). If you need help understanding any of these, please read the correcponsing OpenGL documentation papers like here or here.
So just change the vertices accordingly when you want to move them. You are already doing the low level work, no need to use GeometryBatchFactory or BatchNode.
To be as explicit as possible: you have to modify the vertex coordinates within a mesh to simulate multiple meshes. In actuality you have just 1 mesh, but it is dynamic.
Well, I changed the point meshes to standard box meshes.
The number of objects decreased, but FPS remained unchanged. For sure on every
rendering batching is performed, so this poor performance (only 600 objects cannot take much CPU time).
I also tried to use the unpacked meshes instead “optimized” , this is do nothing. But in other scene with extreme count of objects 200 000 I got better performance during batching.
Batching off:
Batching on:
Other scene (batching on):
With:
Geometry box = new Geometry("Box" + i, new Box(Vector3f.ZERO, 1, 1, 1));
Geometry box1 = new Geometry ();
Mesh boxmesh =new Mesh();
boxmesh=box.getMesh();
box1.setMesh(boxmesh);
Sorry, in the second test “box1” had static position. Truly fps the same.
Also, the addition of four materials of boxes take up fps, but have freezing.
Truly on every frame batching is performed, and take of many CPU cycles.