ReleaseTexImage on Andorid 9 using SurfaceTexture in detached mode
I'm using SurfaceTexture in detached mode i.e SurfaceTexture(isSingleBufferedSurface) to create a surface texture and creating a Surface and using it in native code.
While updating SurfaceTexture I'm calling ReleaseTexImage which works perfectly fine in Android 10.
But in Android 9, I need to fake by attaching SurfaceTexture to GLContext using attachToGLContext for which I need to generate a texName using glGenTextures to call ReleaseTexImage, else it crashes.
However, glGenTextures is always returning me a 0 texName which could only mean that GLContext is not set on the thread. So how can I create a GLContext on the thread as current GLContext or share it from main thread so that I can use glGenTextures ?
Also, how do I get ReleaseTexImage working on android 9 in detached mode of SurfaceTexture without faking this ?