I am studying the Rajawali framework for Android. I tried their first basic tutorial which is as follows:
public class RRenderer extends RajawaliRenderer {
private DirectionalLight mLight;
private BaseObject3D mSphere;
public RRenderer(Context context) {
super(context);
setFrameRate(60);
}
protected void initScene() {
mLight = new DirectionalLight(1f, 0.2f, 1.0f); // set the direction
mLight.setColor(1.0f, 1.0f, 1.0f);
mLight.setPower(2);
Bitmap bg = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.earthtruecolor_nasa_big);
DiffuseMaterial material = new DiffuseMaterial();
mSphere = new Sphere(1, 18, 18);
mSphere.setMaterial(material);
mSphere.addLight(mLight);
mSphere.addTexture(mTextureManager.addTexture(bg));
addChild(mSphere);
mCamera.setZ(-4.2f);
}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
super.onSurfaceCreated(gl, config);
}
public void onDrawFrame(GL10 glUnused) {
super.onDrawFrame(glUnused);
mSphere.setRotY(mSphere.getRotY() + 1);
}
}
All I am doing is creating a Sphere and adding an Earth image as a texture to it. The size of the image is 1024x512.
When I run this code on my Samsung Galaxy SL, the sphere is not having this texture instead it is in a dark grey color. But when I run this code on other devices (Nexus 7 and Sony Xperia), the texture is displayed correctly. Also if I use a texture like 512x512, the texture is displayed correctly on Samsung Galaxy SL.
I found a hint but dont know how to proceed: OpenGL ES 2.0 texture not showing on some device