Hi guys,
I have identified the source of the rendering problem.
For this I created a more simplified model with two geometries of only three vertices each.
Then I printed the values of the vertices obtained from the merging of triangles in GeometryBatchFactory.optimize. The results follow below, and shows the values obtained in android 6 and android 7.
The values should be the same. But in android 7 we have strange values.
ANDROID 6
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: Position Buffer
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: 1.0, 0.0, 1.0
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: 1.0, 0.0, -1.0
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: -1.0, 0.0, -1.0
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: 0.8, 0.0, 1.2
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: -1.2, 0.0, -0.8
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: -1.2, 0.0, 1.2
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: TexCoord Buffer
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: 1.0, 1.0
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: 1.0, 0.0
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: 0.0, 0.0
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: 1.0, 1.0
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: 0.0, 0.0
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: 0.0, 1.0
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: Indexes Buffer
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: 0, 1, 2
07-30 19:52:28.535 3899-3974/com.mycompany.mygame I/System.out: 3, 4, 5
ANDROID 7
07-30 19:48:39.832 9615-9644/com.mycompany.mygame I/System.out: Position Buffer
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: 4.6006E-41, 0.0, 4.6006E-41
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: 4.6006E-41, 0.0, 4.6185E-41
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: 4.6185E-41, 0.0, 4.6185E-41
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: -4.28443616E8, 0.0, -6.35269E-23
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: -6.352771E-23, 0.0, -4.28447712E8
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: -6.352771E-23, 0.0, -6.35269E-23
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: TexCoord Buffer
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: 4.6006E-41, 4.6006E-41
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: 4.6006E-41, 0.0
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: 0.0, 0.0
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: 4.6006E-41, 4.6006E-41
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: 0.0, 0.0
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: 0.0, 4.6006E-41
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: Indexes Buffer
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: 0, 1, 2
07-30 19:48:39.833 9615-9644/com.mycompany.mygame I/System.out: 3, 4, 5
Inquiring where these values were calculated I came to the source of the problem.
This is where you make use of the conversion of buffers to FloatBuffer.asReadOnlyBuffer.
The data indicates that it is a bug with the java.nio lib for android 7.
It makes sense because as already mentioned by rickard from the Android 7 the adopted Java implementation changed to OpendJDK.
In my case this bug caused the following problems:
1 - Rendering error for models obtained from the merging of two or more geometries in GeometryBatchFactory.optimize;
2 - Error of rendering of the material applied to these same models;
3 - Error in generating collision shapes in KinematicRagdollControl.
Sources Affected:
com.jme3.scene.VertexBuffer;
jme3tools.optimize.GeometryBatchFactory.
After eliminating the use of this type of conversion everything has normalized. I was able to do this simplification because my game has no thread safe question at this point.