filament icon indicating copy to clipboard operation
filament copied to clipboard

Can we use Android SurfaceTexture as the input for on-screen rendering?

Open runchen0518 opened this issue 4 years ago • 3 comments

Hello, filament supports on-screen rendering and off-screen rendering now. When we used on-screen rendering, we can use a NativeWindow as the input to createSwapChain, or we can use off-screen rendering without any real windows.

problem

The problem is that when we use rendering, we can't get the texture from filament directly. Therefore, we need readPixels from filament, and then, load pixel buffer to gpu texture, which takes a lot of time.

idea

Okey, I have a idea about on-screen rendering, I want to do some optimization. Can we use android SurfaceTexture as the input for on-screen rendering? If so, I can get the rendered texture just from SurfaceTexture outside directly.

OS and backend

os: android platform, backend: opengl.

runchen0518 avatar Dec 15 '21 06:12 runchen0518

You can use the SurfaceTexture as a Filament texture to render it on screen. You could also get the SurfaceTexture from a TextureView and render into + send it to the video encoder. You could also use a virtual display.

romainguy avatar Dec 15 '21 06:12 romainguy

You can use the SurfaceTexture as a Filament texture to render it on screen. You could also get the SurfaceTexture from a TextureView and render into + send it to the video encoder. You could also use a virtual display.

Is there any samples about surfacetexture input? I've tried it half year ago, but unfortunately, I failed.

runchen0518 avatar Dec 15 '21 06:12 runchen0518

You can use the SurfaceTexture as a Filament texture to render it on screen. You could also get the SurfaceTexture from a TextureView and render into + send it to the video encoder. You could also use a virtual display.

I wanna use surfacetexture instead of any real window, because it is well separated from the upper UI layer.

runchen0518 avatar Dec 15 '21 06:12 runchen0518