I'm building an Android app that takes advantage of OpenGL. As it stands, the background for the GLSurfaceView
is dynamically generated by my code and loaded in as a texture and drawn with glDrawTexfOES
. Which is "ok", but I can simply display the image much more smoothly to its own surface (without OpenGL). Is there any way that I can make the background of a GLSurfaceView
transparent? I've heard some rumors that this can be done with setEGLConfigChooser
, but I haven't found any confirmation. Ultimately, I'd like to take a surface which I'm drawing to and put the GLSurfaceView
over it to achieve a layered effect.
I know this is a tricky and is quite possibly infeasible, but any input is appreciated. Thanks in advance.
Just some simple changes that I did to get this to work.
On my GLSurfaceView.Renderer
:
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
gl.glDisable(GL10.GL_DITHER);
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT,
GL10.GL_FASTEST);
gl.glClearColor(0,0,0,0);
gl.glEnable(GL10.GL_CULL_FACE);
gl.glShadeModel(GL10.GL_SMOOTH);
gl.glEnable(GL10.GL_DEPTH_TEST);
}
On my GLSurfaceView
:
setEGLConfigChooser(8, 8, 8, 8, 16, 0);
getHolder().setFormat(PixelFormat.TRANSLUCENT);