У меня есть приложение GL_DEPTH_TEST в моем приложении для Android.но это результат моего OpenGl PixelBuffer (только в первый раз) Как это изображение: init:
int[] version = new int[2];
int[] attribList = new int[] {
EGL_WIDTH, mWidth,
EGL_HEIGHT, mHeight,
EGL_NONE
};
// No error checking performed, minimum required code to elucidate logic
mEGL = (EGL10) EGLContext.getEGL();
mEGLDisplay = mEGL.eglGetDisplay(EGL_DEFAULT_DISPLAY);
mEGL.eglInitialize(mEGLDisplay, version);
mEGLConfig = chooseConfig(); // Choosing a config is a little more complicated
mEGLContext = mEGL.eglCreateContext(mEGLDisplay, mEGLConfig, EGL_NO_CONTEXT, null);
mEGLSurface = mEGL.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig, attribList);
mEGL.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext);
mGL = new MatrixTrackingGL((GL10) mEGLContext.getGL());
Surface Created:
gl.glEnable(GL10.GL_DITHER);
gl.glEnable(GL10.GL_LIGHT0);
gl.glShadeModel(GL10.GL_SMOOTH);
gl.glDepthFunc(GL10.GL_LEQUAL);
gl.glEnable(GL10.GL_DEPTH_TEST);
//gl.glClearDepthf(1.0f);
gl.glClearDepthx(65536);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glHint(GL10.GL_POINT_SMOOTH_HINT, GL10.GL_NICEST);
gl.glHint(GL10.GL_POLYGON_SMOOTH_HINT, GL10.GL_NICEST);
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
if (mTranslucentBackground) {
gl.glClearColor(0,0,0,0);
} else {
gl.glClearColor(1,1,1,1);
}
OnDrawFrame:
gl.glDisable(GL10.GL_STENCIL_TEST);
gl.glDisable(GL10.GL_DITHER);
gl.glDisable(GL10.GL_DEPTH_TEST);
gl.glClearColor(0f, 0f, 0f, 0.0f);
gl.glClearDepthf(1.0f);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glDepthMask(true);
gl.glEnable(GL10.GL_DEPTH_TEST);