Android 4 versus 7 compatibility


#1

hi i’m porting my simple videogame based of open gl es 2 in a different smartphone (galaxy j7):
it works fine with Galaxy note 2 (open gl es 2 and android 4.2) , bad in Galaxy j7 (open gl es 3.1 and android 7)
when I draw two geometries 3D one above the other something goes wrong

I’ve posted the bad effect in this video youtube (look for with google) youtu.be/xJHfKASQ-7k

while this is a screeshot about note2 in youtu.be/ERljT0O3vW4

i use the code
glView = new GLSurfaceView(this);
glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);

   and every 30 mills I call glView.requestRender() 

Perhaps in android 7 rendermode_with_dirty doesn’t work? or different settings/instruction open gl are needed?

1)in the draw method of the game loop
GLES20.glClearColor(0, 0, 0, 1);
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
GLES20.glClearDepthf(1.0f);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
(draw goemetries)
GLES20.glFlush();

2)for each geometry 3d I do

GLES20.glEnable(GLES20.GL_CULL_FACE);
GLES20.glDisable(GLES20.GL_BLEND);
GLES20.glDepthMask(true);
(load program -shader etc - etc…)
GLES20.glDisable(GLES20.GL_CULL_FACE);


#2

Could be a face culling issue.

For the problem mesh(es), is it possible that on the J7 you are rendering with backface culling enabled sometimes but not always (GL_CULL_FACE)?

Alternatively, is it possible that you don’t always have the front face set consistently (glFrontFace) when rendering the problem mesh(es)?


#3

thanks! But I’ve explained better my problem. I’ve corrected my post