How to render a surface using OpenGL ES without GLSurfaceRenderer

I need to draw a decoded video frame in an android.view.Surface object in the source C ++ Android code.

I understand that the general way to do this is to implement the GLSurfaceView.Renderer interface and call your own method from onDrawFrame() . But I can’t use it, I need to pass the Surface object to the native method and work with it from there.

I plan to use the OpenGL ES API to complete the entire rendering task because it is cross-platform. But I have no idea where the Surface object is.

I saw some examples where ANativeWindow_fromSurface() . I think I could go this way if I were not forced to use OpenGL.

So where do I β€œset” my Surface object inside my own code, so that I am well versed in rendering my scene frames?

EDIT: Well, I just didn't know about the EGL standard , which seems to be what I need in the case presented.

However, I'm still looking for a way to "map" or "transform" the android.view.Surface object to any structure processed by the EGL context, which I assume is EGLNativeWindowType , without having to access any Android-specific APIs.

Thanks in advance.

+4
source share

Source: https://habr.com/ru/post/1468979/


All Articles