Hi,
I’m trying to run a very basic example on Android and I always get the terrain rendered in black. What I’m doing is create a basic game project, create a new scene, add a simple terrain (tried also painting some textures, creating relief, etc.), add a directional light (I also added at some point all possible lights in the scene), and then from the main application, I’m loading that scene and adding it to the root node. On desktop everything is fine, but on Android the terrain renders all black.
I’ve also tried adding the directional light in the code, even applied a Terrain.j3md material from the code. Nothing helped.
I thought is the device, but then the SimpleTerrainAndroid example runs perfectly on the same device so I can’t seem to figure out what I am doing wrong.
Is there any declaration, modification that is required in the manifest, main application class, etc.? Also to mention that I have played in the past with JME3 beta and RC2 and the terrain rendered fine on Android, same device and without major modifications. I tried both stable (download and also Updated version) and nightly versions and it’s the same.
The only time I could get the terrain texture to render was when applying an unshaded material, however if I am to use the engine I need at least the Terrain.j3md material to render on mobile.
I’m sure it’s me that I’m doing something wrong, but hope someone can help me tell what am I missing. This is the simplest code I am using:
[java]
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.light.DirectionalLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Spatial;
public class Main extends SimpleApplication {
public static void main(String[] args) {
Main app = new Main();
app.start();
}
@Override
public void simpleInitApp() {
viewPort.setBackgroundColor(ColorRGBA.Blue);
/** A white, directional light source */
Spatial scene = assetManager.loadModel( “Scenes/level1.j3o” );
rootNode.attachChild(scene);
DirectionalLight sun = new DirectionalLight();
sun.setDirection((new Vector3f(-0.5f, -0.5f, -0.5f)).normalizeLocal());
sun.setColor(ColorRGBA.White);
rootNode.addLight(sun);
}
@Override
public void simpleUpdate(float tpf) {
//TODO: add update code
}
@Override
public void simpleRender(RenderManager rm) {
//TODO: add render code
}
}
[/java]