Flickering in android

#1

Is this a case of flickering? Or bad depth test?
(video YouTube)

This is produced only in android 7, not in android 4

#2

Sure looks like depth test problems.

Make sure that you have a depth buffer, are clearing depth at beginning of frame to the far depth value, have depth writes and depth tests enabled for both terrain and water surfaces, and that you’re using the same depth range, same depth test function, and same projection transform to render everything.

#3

yes, as first lines of Activity method draw() i put

GLES20.glClearColor(0, 0, 0, 1);
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
GLES20.glClearDepthf(1.0f);

there aren’t object that disable deph test (only every object able or not cull facing…)

moreover in android 4 (open gl es 2) all goes fine ( http://youtu.be/ERljT0O3vW4 )

#4

Ok. And I assume that right below this, there is a

GLES20.glClear( GL_DEPTH_BUFFER_BIT );

right? (The argument being any valid value which has the depth bit set)

In your before/after comparison, you’re comparing OpenGL ES 2.0 with OpenGL ES 2.0, so that’s the same. And you’re comparing Android 4 (works) with Android 7 (broke), right?

Is this on an OpenGL ES driver written by the same GPU vendor?

Are both of these tests being run on the exact same Samsung Galaxy J7? If so, which?: 2015 or 2016?

If both tests being done on the same Galaxy J7, then (if we presume that the GL portion of your app code is bug free – admittedly a big “if”), then I would check very carefully to ensure that on Android 7, you are actually getting a render target with a depth buffer. The behavior that you’re seeing might be explained by your app getting a depth buffer on Android 4, but for some reason “not” getting a depth buffer on Android 7. Perhaps it’s not requesting the format correctly via EGL? (or at least, not correctly for Android 7?)

Let’s see your full EGL context init. For instance, let’s see what you are passing eglChooseConfig() (EGL_DEPTH_SIZE should be in that list), eglCreateContext(), and eglCreateWindowSurface(). For context, see Understaing Android EGL (slides).