androidopengl-esmali

Android OpenGL ES not rasterizing - Matrix multiplication switched


I just bought a new SGS3 (I9300 - NOT LTE) and hoped to continue with developing an OpenGL ES (2) application. Unfortunately when I compile it I don't see anything.

I get the following LogCat error messages:

D/libEGL(6890): loaded /system/lib/egl/libEGL_mali.so
D/libEGL(6890): loaded /system/lib/egl/libGLESv1_CM_mali.so
D/libEGL(6890): loaded /system/lib/egl/libGLESv2_mali.so
E/(6890): Device driver API match
E/(6890): Device driver API version: 23
E/(6890): User space API version: 23 
E/(6890): mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Wed Oct  9 21:05:57 KST 2013** 
D/OpenGLRenderer(6890): Enabling debug mode 0

I also installed a custom rom (cyanogenmod 11 - snapshot M4) but I get the same problem.

When I start the app, I get the blank screen without any vertices rasterized. The clear color works so far so the basic functionality of OpenGL is working.

enter image description here

To be sure I tried it with the basic tutorial from the Google Developers page with GLES 1 and GLES 2. Both don't work! Here are the screenshots:

http://developer.android.com/training/graphics/opengl/index.html

The project itself works fine on my old Galaxy S1 (also on Cyanogenmod) but does not show anything else than a blank screen on my SGS3.

Is it possible that the Mali-400 MP4 graphics driver / system interpret GL commands differently? Is there a different way of calling than with the Hummingbird GPU from my SGS1?

Has anyone an idea what to do? Is this a problem with my phone or eclipse? Or is this normal - just my lack of understanding? How can I fix this problem?

------- EDIT : SOLUTION FOUND -------

Okay, I found the error. The google document shows a "wrong" the multiplication of the matrices in the vertex shader:

uniform mat4 uMVPMatrix;
attribute vec4 vPosition;
void main() {
   gl_Position = uMVPMatrix * vPosition;
}

This doesn't seem to be a problem for my old Galaxy S1 but somehow the S3 (or the Mali GPU) is picky about this. I changed the order of multiplication to this:

uniform mat4 uMVPMatrix;
attribute vec4 vPosition;
void main() {
   gl_Position = vPosition * uMVPMatrix;
}

And it works (also on the S1). Still not sure why the S1 works fine with both versions but this solves the problem.

Thanks for your help!


Solution

  • Just off the top of my head, did you check the projection settings? It's possible those shapes are being drawn, just not where you expect them to be.

    Also, check the return values for the shader loading steps. If there's a compile issue, you'll get an invalid handle for the shader program.