【问题标题】:Possible to draw on SurfaceTexture attached to camera?可以在连接到相机的 SurfaceTexture 上绘图吗?
【发布时间】:2011-12-20 21:14:52
【问题描述】:

我想在通过setPreviewTexture 连接到CameraSurfaceTexture 上绘图。我可以通过SurfaceTextureListener 获得SurfaceTexture。但是,如果我只是尝试使用eglCreateWindowSurfaceeglMakeCurrent,由于表面已经连接,它会失败。

1) 可以在这个表面上画画吗?或者将其绑定到相机是否无法做到这一点。

2) 如果不可能。是否可以快速使用(或复制)曲面到 OpenGL 纹理并在单独的曲面中使用?如果有怎么办?

3) 如果没有,将相机预览从 SurfaceTexture 导入 OpenGL 的最快方法是什么?

另外请注意,导致我无法连接的代码的灵感来自 Romain Guy 的帖子:http://groups.google.com/group/android-developers/browse_thread/thread/539457146a401cf1

【问题讨论】:

    标签: android android-camera


    【解决方案1】:

    是的,这是可能的,确实是 SurfaceTexture 的全部要点。问题是我在向后考虑它们。为了让它们发挥作用,您需要:

    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).
    

    我最大的问题是试图弄清楚如何做相反的事情。也就是说,创建一个 SurfaceTexture 并将其传递给 OpenGL。但正确的做法恰恰相反。

    【讨论】:

    • 很有趣,谢谢。首先,您是如何创建 EGL 上下文来创建 OpenGL 纹理的?你有 GLSurfaceView 吗?谢谢。
    • 这里是 user1906 发布他的问题并得到答案的地方:stackoverflow.com/a/23380229/199364
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-23
    • 1970-01-01
    • 2020-03-02
    • 2013-10-16
    • 1970-01-01
    • 2022-09-27
    • 1970-01-01
    相关资源
    最近更新 更多