Galaxy S2 Unsupported?

Hey guys. I got a bit of a problem loading a 3D model on my Galaxy S2. It works on Desire S and Galaxy Nexus.

But when running on Galaxy S2 it crashes when I attach the model to the rootNode with the following message:

[java]03-05 11:08:56.725: E/AndroidHarness(29488): Exception thrown in Thread[GLThread 3111,5,main]

03-05 11:08:56.725: E/AndroidHarness(29488): com.jme3.renderer.RendererException: OpenGL Error 1280

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.renderer.android.OGLESShaderRenderer.checkGLError(OGLESShaderRenderer.java:141)

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.renderer.android.OGLESShaderRenderer.updateUniform(OGLESShaderRenderer.java:938)

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.renderer.android.OGLESShaderRenderer.updateShaderUniforms(OGLESShaderRenderer.java:947)

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.renderer.android.OGLESShaderRenderer.setShader(OGLESShaderRenderer.java:1238)

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.material.Material.render(Material.java:1037)

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:649)

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:299)

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:351)

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:886)

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:842)

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1118)

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.renderer.RenderManager.render(RenderManager.java:1160)

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.app.SimpleApplication.update(SimpleApplication.java:253)

03-05 11:08:56.725: E/AndroidHarness(29488): at com.jme3.system.android.OGLESContext.onDrawFrame(OGLESContext.java:370)

03-05 11:08:56.725: E/AndroidHarness(29488): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)

03-05 11:08:56.725: E/AndroidHarness(29488): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)

[/java]

Update to last nightly, this error should be fixed

I am using the latest SVN build. Seems like this has something to do with shaders, because if I only load the wheels for the car model, it works fine. Its only when I load the complete car model it crashes.

Okay, I went through all the childs of the Node which contains the car, and found that one mesh is the problem.

[java]public static class LineLoader implements Callable<Integer> {

final String lineName;



public LineLoader(String name) {

lineName = name;

}



@Override

public Integer call() throws Exception {

while (modelCar != null) {

modelCar.detachAllChildren();

modelCar.removeFromParent();

modelCar = null;

}

Log.e("LineLoader", "Loading Model: " + lineName);

modelCar = (Node) assetManager.loadModel(lineName);

Log.e("LineLoader", "Loading Done: " + lineName);

modelCar.setLocalRotation(new Quaternion().fromAngles(-1.57079633f, 0, 0));

modelCar.scale(0.03f);



modelCar.getChild(5).setMaterial(assetManager.loadMaterial("assets/materials/clearglass.j3m"));

modelCar.getChild(9).setMaterial(assetManager.loadMaterial("assets/materials/windowglass.j3m"));

modelCar.getChild(10).setMaterial(assetManager.loadMaterial("assets/materials/redglass.j3m"));



modelCar.getChild(5).setQueueBucket(RenderQueue.Bucket.Transparent);

modelCar.getChild(9).setQueueBucket(RenderQueue.Bucket.Transparent);

modelCar.getChild(10).setQueueBucket(RenderQueue.Bucket.Transparent);



modelCar.detachChildAt(3);



carNode.attachChild(modelCar);

return null;

}

}[/java]

As you can see, if I detach child number three, which is the car body (contains the most vertices). It loads just fine.

Ive tried setting a Unshaded material for the chassis to see if thats the problem, but it still crashes.

The strange thing is, JMonkeyPlatform shows the model just fine on my PC.

how many vertices does number three have?

Vertexes: 96828

Triangles: 32297



The whole model:

Vertexes: 221427

Triangles: 74058



But please remember, this runs just fine on Desire S and Galaxy Nexus.

Won’t even render on Galaxy S2, just throws that error.

what android OS do they run?

Galaxy Nexus: 4.0.3

Desire S: 2.3.5

Galaxy S2: 4.0.3



The Galaxy S2 was running 2.3.4 earlier. It ran fine with that, but all models was completely black.

I don’t have the same line numbers in OGLESShaderRenderer as yours, are you sure you’re running against the latest SVN?



It’s gonna be hard to sort this out, i don’t have this device and even if I can find one…it won’t be with that android version.

error 1280 means invalid Enum. this means something is passed to opengl and that your drivers does not support…



There can be a lot of things causing this…if you’re using the SVN a way to detect where it fails would be to move the checkGLError up in the updateUniform method to narrow down which gl call causes this error.

Ill try moving the checkGLError. Thanks :wink:

thanks to you, please post your progress on this.

I tried moving it back and tracing the source, takes me all the way back to Material.renderMultipassLighting :confused:

I haven’t located the troublesome part yet, but might this have something to do with the problems in rendering lighting on the galaxy S2 in general?

If it helps I’m running my app on a galaxy SII and it is running fine so far. Admittedly I’ve not tried anything complex yet as I’ve just started the project but I have a nifty GUI and a spinning object with lighting and texturing. Android version is 2.3.3 atm.

Good to hear its working for some people atleast.

Anyways, I checked the shaders in the meshes thats working, and in the meshes thats not working.

[java]Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {

MaterialParameters {

Specular : 0.492157 0.492157 0.492157 1.0

Diffuse : 0.602353 0.602353 0.602353 1.0

UseMaterialColors : true

ParallaxHeight : 0.05

Ambient : 0.0 0.0 0.0 1.0

Shininess : 96.07843

}

AdditionalRenderState {

FaceCull Back

Wireframe Off

DepthWrite On

PolyOffset 0.0 0.0

AlphaTestFalloff 0.0

Blend Off

PointSprite Off

ColorWrite On

DepthTest On

}

}[/java]

Its exactly like this, only the ambient and specular is slightly different

I tried changing the material of the mesh causing the problems:

[java]modelCar.getChild(3).setMaterial(new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md"));[/java]

Anyways, this caused the whole car to disappear :confused:

The lighting issue on Galaxy S2 was only reported for android 2.3.4 afaik.



The 1280 error must be tracked down, something wrong is sent to opengl.

What if you remove the checkGLError? sometime some error are not fatal, we do raise an error but it may be able to render it.

Disabling error checking gives me this:

[java]03-06 11:12:48.215: E/AndroidHarness(4028): Exception thrown in Thread[GLThread 5379,5,main]

03-06 11:12:48.215: E/AndroidHarness(4028): com.jme3.renderer.RendererException: OpenGL Error 1280. Enable error checking for more info.

03-06 11:12:48.215: E/AndroidHarness(4028): at com.jme3.renderer.android.OGLESShaderRenderer.onFrame(OGLESShaderRenderer.java:727)

03-06 11:12:48.215: E/AndroidHarness(4028): at com.jme3.system.android.OGLESContext.onDrawFrame(OGLESContext.java:407)

03-06 11:12:48.215: E/AndroidHarness(4028): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)

03-06 11:12:48.215: E/AndroidHarness(4028): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)

[/java]

I can send you the 3D model if you wanna have a look.

The j3o file consists of 10 meshes. If I remove mesh 3 from the loaded node everything renders just fine.

The weird thing is, it shows just fine in jMonkeyPlatform.

I tried setting the material of mesh 3 to unshaded, made all 10 meshes disappear.

@mradam said:
I tried changing the material of the mesh causing the problems:
[java]modelCar.getChild(3).setMaterial(new Material(assetManager, &quot;Common/MatDefs/Misc/SolidColor.j3md&quot;));[/java]
Anyways, this caused the whole car to disappear :/


SolidColor.j3md is depreciated use Unshaded.j3md
@wezrule said:
SolidColor.j3md is depreciated use Unshaded.j3md

I tried that as well.