我要画上顶部的表面纹理
是通过设置previewTexture 。我可以用 SurfaceTextureListener
获得表面纹理
。但是,如果我只是尝试使用 eglCreateWindowSurface
&放大器; eglMakeCurrent
失败,由于表面已经被连接。
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 eglCreateWindowSurface
& eglMakeCurrent
it fails due to the surface already being connected.
1)是否有可能利用这面呢?抑或是结合相机使它不可能做到这一点。
1) Is it possible to draw on this surface at all? Or does binding it to the camera make it impossible to do that.
2)如果它是不可能的。可以表面使用(或复制)迅速一个OpenGL质地和在一个单独的表面上使用?如果是的话怎么样?
2) If it isn't possible. Can the surface be used (or copied) quickly to an OpenGL texture and used in a separate surface? If so how?
3)如果没有,会是什么让相机preVIEW出的表面纹理,进入OpenGL的最快方法是什么?
3) If not, what would be the fastest way to get the camera preview out of a SurfaceTexture and into OpenGL?
另外请注意,在code,它给我的失败已经被连接的灵感来自于罗曼盖伊的在这里发表有关:的http://groups.google.com/group/android-developers/browse_thread/thread/539457146a401cf1
Also note, the code that gave me the failure regarding already being connected was inspired by Romain Guy's post here: http://groups.google.com/group/android-developers/browse_thread/thread/539457146a401cf1
推荐答案
是的,这是可能的,一个表面纹理确实整点。问题是,我在想他们落后。为了让他们的工作,你需要:
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 this new SurfaceTexture to the camera.
4) Make sure you are using OES_External (see documentation for
details).
我的最大的问题就是试图找出如何做相反。也就是说,创建表面纹理,并将其传递到OpenGL的。但相反的是做正确的方式。
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.
相关推荐
最新文章