I have noticed that if I try to call API calls before surface is created such as
GLES20.glGenTextures(textures.size(), textureHandle,0); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle[i]);
They don't behave properly, for example texture handler being returned as 0 all the time.
So I put my initiation methods under onSurfaceCreated call.
public void onSurfaceCreated(GL10 arg0, EGLConfig arg1) {
if(initiated)return;
BitmapLoader.onOpenglGLInitiated();
program.init();
initiated = true;
}
However such results in being recalled whenever surface is recreated; when a user pauses and resumes as well. In which reuslts in double initiation, thus an error. I want to know where exactly should be a better place to put my initiation codes.