My app is composed (from back to front) of an image background, then a glSurfaceView containing a 3D object and on the top 2 buttons. I want the background of the GLSurfaceView to be transparent and see the image behind.
I've tried two solutions, but none of them is satisfying :
mGLSurfaceView = new GLSurfaceView(mContext);
mGLSurfaceView.setEGLContextClientVersion(2);
mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
mGLSurfaceView.setZOrderOnTop(true);
mGLSurfaceView.setRenderer(mRenderer);
In this case, I can see the background, but the 3D object is floating on the top of all the other layouts, sometimes hiding the buttons.
mGLSurfaceView = new GLSurfaceView(mContext);
mGLSurfaceView.setEGLContextClientVersion(2);
mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
mGLSurfaceView.setZOrderMediaOverlay(true);
mGLSurfaceView.setRenderer(mRenderer);
In that case, I can see the buttons, but the GLSurfaceView is no longer transparent and I cannot see the image background. I've parsed all the other topics, but none of them gave me any satisfying answer.