How to copy texture in OpenGL context to another context

I am trying to record a video using MediaCodec on Android using OpenGL ES 2 contexts.

To do this, I want to use a writable surface using:

private static final int EGL_RECORDABLE_ANDROID = 0x3142;

to create a new context. In fact, I tore the scene in the texture in my first context. And I want to do this in a new context for sending data to MediaCodec.

I'm trying to do the same thing as this breakthrough tutorial with a patch for writing

I implemented InputSurface and GameRecorder in my game, but I only record an empty scene.

My main problem is that the same OpenGL objects are not used in the context, and I do not know the best solution for this.

How can I send the final rendering of the image or the entire scene for rendering in the same stream , to avoid problems with the streams, in order to correctly record the surface?

+3
source share
1 answer

Start by reviewing the “Write GL application with FBO” action in Grafika . It demonstrates three different ways to record video games (well, two that work, and one that will work in the future).

EGL- "share" , - Breakout "Show + capture camera" Grafika. GLSurfaceView, , , .

, Surface , , ; , EGLSurface EGLContext. "Record GL app with FBO". SurfaceView, EGL, - GLSurfaceView, .

, Breakout ( ), FBO, blitting , glBlitFramebuffer() GLES3 API 19, .

+4

All Articles