将数据从一个纹理复制到另一个纹理 - opengl

时间:2015-03-12 14:27:52

标签: android opengl-es shader render-to-texture

我在SurfaceTexure上在Android中渲染我的相机预览。此SurfaceTexture绑定到GL_TEXTURE_EXTERNAL_OES。 我想将此SurfaceTexture对象的纹理数据复制到绑定到GL_TEXTURE_2D的自定义OpenGL纹理。

我的onFrameAvailable回调如下:

@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
        }
    });
}

我已经创建了自定义纹理对象。

任何人都可以帮我复制部分吗?

1 个答案:

答案 0 :(得分:1)

通常的方法是将颜色附件的纹理绑定到FBO,选择该FBO为活动状态,并使用glCopyTexImage从FBO复制到目标纹理。

相关问题