Skip to content Skip to sidebar Skip to footer

Possible To Draw On Surfacetexture Attached To Camera?

I want to draw on top of a SurfaceTexture that is connected to a Camera via setPreviewTexture. I can get the SurfaceTexture by a SurfaceTextureListener. But if I just try to use

Solution 1:

Yes this is possible, indeed the whole point of a SurfaceTexture. The problem was that I was thinking about them backward. In order to get them to work you need to:

1) Create a texture through OpenGL.
2) Pass this texture to the constructor of new SurfaceTexture.
3) Give thisnew SurfaceTexture to the camera.
4) Make sure you are usingOES_External (see documentation for
details).

My biggest problem was trying to figure out how to do the reverse. That is, create a SurfaceTexture and pass it into OpenGL. But the opposite is the correct way to do it.

Post a Comment for "Possible To Draw On Surfacetexture Attached To Camera?"