I\'m currently learning OpenGL ES programming on Android (2.1). I started with the obligatory rotating cube. It\'s rotating fine but I can\'t get the depth buffer to work. T
I was using the GL2JNIView provided in the hello-gl2 sample in NDK r10, and I was also having this issue.
The problem was that when creating the GL2JNIView object, i didn't specify the depth size on the constructor, so that the private class ConfigChooser could find the right EGL configuration.
public GameJNIView(Context context, boolean translucent, int depth, int stencil){...}
public GameJNIView(Context context){...}
myView = new GL2JNIView(this, false, 16, 0);
instead of
myView = new GL2JNIView(this);
Found it myself. It wasn't GL code, it was android code:
view.setEGLConfigChooser(false);
The "false" in this line explicitly says that no Z-Buffer should be allocated. After switching it to "true" it worked perfectly.