I'm rendering my camera preview in android on a SurfaceTexure. This SurfaceTexture is bound to target GL_TEXTURE_EXTERNAL_OES.
I want to copy the texture data from this SurfaceTexture object to my custom OpenGL texture which is bound to GL_TEXTURE_2D.
My onFrameAvailable callback is as follows :
@Override
public void onFrameAvailable(final SurfaceTexture surfaceTexture) {
glView.queueEvent(new Runnable() {
@Override
public void run() {
surfaceTexture.updateTexImage();
//TODO: Copy this texture to the custom texture
}
});
}
I have the custom texture object created already.
Can anyone help me with the copying part ?
The usual approach is to bind the texture at a color attachment to an FBO, select that FBO as active and use glCopyTexImage to copy from the FBO into the destination texture.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With