3

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!

Tobias Reich
  • 4,952
  • 3
  • 47
  • 90
  • There are many differences between OpenGL ES drivers, and in many cases there are driver bugs that cause additional problems. You need to post more of your code and shader code. – Muzza Mar 17 '14 at 01:12
  • I used exactly the OpenGL ES2 example from the google pages (see Link above). So everything should be standard. – Tobias Reich Mar 17 '14 at 09:17

2 Answers2

1

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.

Josh
  • 10,618
  • 2
  • 32
  • 36
  • Well I used the basic project from the google pages. And it still works on my S1 so I guess I'm not missing one of the basic things. I posted the code. Do you find anything? – Tobias Reich Mar 18 '14 at 16:42
  • Maybe try a different tutorial or example project? For whatever reason, I think I remember someone saying those examples on the dev site were out of date. But I couldn't say for sure. – Josh Mar 18 '14 at 19:25
  • Here's a great set of tutorials, and everything's on GitHub: http://www.learnopengles.com/android-lesson-one-getting-started/ – Josh Mar 18 '14 at 19:26
  • 1
    Ah, oh, Okay, I see my fault. I mixed the order of multiplicating the matrices. – Tobias Reich Mar 18 '14 at 19:52
  • I guess you don't have any idea WHY this is "switched"? Weird to see even the google tutorial does it the other way around. – Tobias Reich Mar 18 '14 at 21:23
0

There may be some warnings or errors in your code which aren't bubbling up to LogCat. I've found that using a native OpenGL wrapper from LibGDX actually shows me those errors and is pretty helpful for debugging.

You can find some helpful pointers on setting up the LibGDX libraries here - http://www.learnopengles.com/android-lesson-seven-an-introduction-to-vertex-buffer-objects-vbos/

Josh
  • 10,618
  • 2
  • 32
  • 36