How to get the image stream when I use GLsurfaceview renderer

704 views Asked by At

I want to get the image stream when I render in glsurfaceview with finger The purpose is record the render form glsurfaceview , I was done it with camera use surfacetexture to encode the .mp4, but I can't get the render from glsurfaceview when I draw.

1

There are 1 answers

4
alijandro On
  • Get your GLSurfaceView's EGLContext with EGL14.eglGetCurrentContext()

  • Use the EGLContext above as shared context in a separated thread to create another EGLContext for recording

  • The recording EGLContext will render into a Surface get from MediaCodec.createInputSurface, also it use the same texture from GLSurfaceView

  • Use MediaMuxer to mux your MediaCodec output to mp4

  • Then you can record your GLSurfaceView to mp4

See the example in sample code