0

有没有办法将相机图片绑定到着色器?

我通过以下方式设置相机预览:

// Create shader and GL program
_texture = new SurfaceTexture( _texName );
_camera = Camera.open();
_camera.setPreviewTexture( texture );
_camera.startPreview(); // What does start preview do internally?

当有新图片可用时,我会:

_texture.updateTexImage(); // Should bind to GL_TEXTURE_EXTERNAL_OS
GLES20.glViewport( 0, 0, _surfaceWidth, _surfaceHeight );
GLES20.glBindFramebuffer( GLES20.GL_FRAMEBUFFER, _framebuffers[0] );
GLES20.glFramebufferTexture2D( GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GL_TEXTURE_EXTERNAL_OES, _texName, 0);

PS原始代码包含错误检查

4

0 回答 0