I’ve got some OpenGL ES code that has been rendering to a
GLSurfaceView, and I’m currently modifying it to work with either
The common element I need from both inside my native code is:
SurfaceView I got it by passing
m_jwindow = ANativeWindow_fromSurface(env, surface);
TextureView, I take
SurfaceTexture, and in API 14 I can use this:
m_jwindow = ANativeWindow_fromSurfaceTexture(env, surface);
However, that function was removed in Jellybean. Which leaves me wondering, how can I get
ANativeWindow from a
SurfaceTexture in API 16+?
What you need to do in API 16+ is create a Surface object, passing the SurfaceTexture as an argument to the constructor (which was introduced in API 14). Pass that Surface to
ANativeWindow_fromSurface() as usual.
Answered By – fadden
Answer Checked By – Marie Seifert (Easybugfix Admin)