I have been trying to get the
perspective demo working on my Android device (Huawei Ascend G300 U8815) but it won't work when lights() are enabled. I think this is the same/similar unresolved problem posted under
Android with light.
I changed the size(640, 360, P3D) call to instead fill the screen:
size(displayWidth, displayHeight, P3D);
but apart from that, the code i'm using is identical to the java demo linked above.
If i comment out the lights() call in the draw() method, it works fine (though no lighting effects of course). With the lights() call left in, i get the following stack trace:
Smooth is not supported by this hardware (or driver)
FATAL EXCEPTION: GLThread 21651
java.lang.RuntimeException: Cannot link shader program:
--From Fragment Shader:
--From Vertex Shader:
at processing.core.PGraphics.showException(PGraphics.java:5426)
at processing.opengl.PShader.init(PShader.java:745)
at processing.opengl.PShader.getAttributeLoc(PShader.java:393)
at processing.opengl.PGraphicsOpenGL$LightShader.loadAttributes(Unknown Source)
at processing.opengl.PGraphicsOpenGL.getPolyShader(Unknown Source)
at processing.opengl.PGraphicsOpenGL.flushPolys(Unknown Source)
at processing.opengl.PGraphicsOpenGL.flush(Unknown Source)
at processing.opengl.PGraphicsOpenGL.endDraw(Unknown Source)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.opengl.PGL$AndroidRenderer.onDrawFrame(Unknown Source)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1463)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1217)
ie it is throwing an exception with message "Cannot link shader program" from PShader::init() line 754:
PGraphics.showException("Cannot link shader program:\n"+
pgl.getProgramInfoLog(glProgram));}
I am running Processing 2.0b8 on Windows 7 64 bit, with the Android SDK Tools 21.1, Android SDK Platform-tools 16.0.2, API 17 and API 10. According to Quadrant, my G300 phone supports OpenGL ES 2.0 and OpenGL ES GLSL ES 1.00 (is that shaders v1.00?).
When build with lights enabled, the exact same apk ran fine on a HTC Desire Z, so maybe this is a lack of support from my G300 device?
Other than the stack trace above, i don't see any more details of the problem. I'm not sure what shader is being loaded/linked for lighting, or where to begin looking for the problem. Any ideas? Is my phone's OpenGL support sufficient for Processing?
I've been unable to get 3D rendering working in the Android emulator, have tried a bunch of stuff already so hoping folks out there might have some more ideas than me!
I gather from previous posts
[1][2] that Processing's default AVD does not enable hardware GPU support so in turn does not support OpenGL / 3D. I have created 2 new AVDs from scratch with "Use Host GPU" selected, one is an API 10 and the other an API 17, but neither of them are able to run 3D apps. 2D apps work fine on the emulators.
The smallest app i can create to reproduce this is:
void setup() {
size(displayWidth, displayHeight, P3D); // crashes, no info to console alas
}
ie merely setting the renderer crashes with a forced close ("this application ... has stopped unexpectedly") and no output in the Processing console.
I am running Processing 2.0b8 on Windows 7 64 bit, with the Android SDK Tools 21.1, Android SDK Platform-tools 16.0.2, API17, API10 and the HAXM accelerator installed (all latest as at 29mar2013). Same problem happened even before installing HAXM.
Any ideas how to get 3D working in emulation? What have i missed?