I'm currently writing an Android app for one my customers that has a GLSurfaceView with a GLSurfaceView.Renderer.
My entire OpenGL stuff works just fine (it's basically a port of what another developer has written on iOS first). Except for one thing. When the view is loaded and thus the OpenGL stuff is getting loaded my background quickly flashes black, and then the OpenGL starts to render correctly (with my background). So what I do is:
In the onSurfaceCreated I start with this:
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
GLES20.glClearColor(0.9f + 0.1f * (21.0f / 255),
0.9f + 0.1f * (36.0f / 255),
0.9f + 0.1f * (31.0f / 255), 1.0f);
// Here goes my other stuff, if I comment all my other stuff out I still get the flash at startup
}
In my onDrawFrame method I do this:
@Override
public void onDrawFrame(GL10 gl) {
GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
// My stuff, again, if I comment all this stuff out I still get the flash...
}
So if I remove all lines of code except for the glClearColor(..) in onSurfaceCreated I still see a black flash before my actual background color is set. If I only remove the glClearColor(..) from my code (and thus leave all other OpenGL stuff in place) everything is rendered on a black background.
What I would like to see is that I just get rid of the black flash and thus that my background color is initialised correctly at startup...
Any ideas how I can achieve that?
Dirk