JME3.1 - Rendering failure specifically for android 7 (Nougat)

Android 7 :neutral_face:
https://imgur.com/a/CsNTi
Android 8

1 Like

I build jme3-core with your with provided link

com.jme3.scene.VertexBuffer;
jme3tools.optimize.GeometryBatchFactory.

https://drive.google.com/open?id=1b2Arj2duzhT__VcViHCmR-mNlRNJax6Z

and seem to patch the problem with rendering… (probably if you willing you can explain the problem again because I did not quit understand it) I have not done any deep testing

this is my

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
maven {
url ‘https://maven.google.com/
name ‘Google’
}
}
dependencies {
classpath ‘com.android.tools.build:gradle:3.0.1’

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:3.1.0'
}

}

allprojects {
repositories {
jcenter()
maven {
url ‘http://dl.bintray.com/jmonkeyengine/org.jmonkeyengine
}
google()
}

// TODO try upgrade java version
tasks.withType(JavaCompile) {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

}

project(“:core”) {
apply plugin: “java”
dependencies {
//compile ‘org.jmonkeyengine:jme3-core:3.2.+’
compile (‘org.jmonkeyengine:jme3-bullet:3.2.+’) {
exclude group: “org.jmonkeyengine”, module: “jme3-core”
}
/*
compile ‘com.googlecode.json-simple:json-simple:1.1.1’
*/
compile(‘org.jmonkeyengine:jme3-lwjgl:3.2.+’) {
exclude group: ‘org.jmonkeyengine’, module: ‘jme3-desktop’
exclude group: “org.jmonkeyengine”, module: “jme3-core”
}

    compile ('org.jmonkeyengine:jme3-effects:3.2.+'){
        exclude group: "org.jmonkeyengine", module: "jme3-core"
    }
    compile ('org.jmonkeyengine:jme3-niftygui:3.2+'){
        exclude group: "org.jmonkeyengine", module: "jme3-core"
    }
    compile ('org.jmonkeyengine:jme3-networking:3.2+'){
        exclude group: "org.jmonkeyengine", module: "jme3-core"
    }
    compile files('libs/cai-nmgen-0.1.2.jar')
    compile files('libs/jme3-core-3.2.1-stable-CUSTOM.jar')

}

}

project(“:desktop”) {
apply plugin: “java”
dependencies {
compile project(“:core”)
/*
compile ‘org.jmonkeyengine:jme3-desktop:3.2.+’
*/
}
}

project(“:app”) {
apply plugin: “android”
dependencies {
compile project(“:core”)
compile (‘org.jmonkeyengine:jme3-android:3.2.+’) {
exclude group: “org.jmonkeyengine”, module: “jme3-core”
}
compile (‘org.jmonkeyengine:jme3-android-native:3.2.+’) {
exclude group: “org.jmonkeyengine”, module: “jme3-core”
}
compile (‘org.jmonkeyengine:jme3-bullet-native-android:3.2.+’){
exclude group: “org.jmonkeyengine”, module: “jme3-core”
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

Hi kaloyan,

The explanation is as follows. The problem is in converting vertex buffer to a read only buffer with the FloatBuffer.asReadOnlyBuffer method.

The new buffer obtained will contain strange coordinate values for the vertices. Therefore, if the position of the vertex is incorrect, the rendering is scrambled.

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.