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