I am using media codec for encoding frame coming from camera and render it using gl surface view.
my ondrawframe looks like this
public void onDrawFrame(GL10 unused)
{
float[] mtx = new float[16];
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
surface.updateTexImage();
surface.getTransformMatrix(mtx);
mDirectVideo.draw(surface);
saveRenderState();
delegate.mInputSurface.makeCurrent();
mDirectVideo.draw(surface);
delegate.swapBuffers();
restoreRenderState();
}
So here we are doing Draw(surface) two times which will render to surface. This will make overhead in system. Is there any where i can do Ondraw once only ? two times using shadder is costly operation Is there any way we can share the surfaces between render and encoder?