如何在Android的冰淇淋三明治替代GLSurfaceView与TextureView? [英] How to replace GLSurfaceView with TextureView in Android Ice Cream Sandwich?

查看:451
本文介绍了如何在Android的冰淇淋三明治替代GLSurfaceView与TextureView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的TextureView 文档说,它可以被用于呈现内容的OpenGL。

The TextureView documentation states that it can be used to render OpenGL content.

博客文章宣布TextureView,它规定

In the blog post announcing TextureView, it states:

一个TextureView可以很方便地用来嵌入OpenGL场景在你的应用程序。由于Android 4.0,eglCreateWindowSurface()可以用来渲染成一个物体表面纹理。

A TextureView can just as easily be used to embed an OpenGL scene in your application. As of Android 4.0, eglCreateWindowSurface() can be used to render into a SurfaceTexture object.

这似乎意味着,要使用,而不是GLSurfaceView TextureView,一会做所有的EGL设置本身和管理EGLContext和线程(因为GLSurfaceView保持GLThread)。似乎没有被任何样品code在Android 4.0 SDK,演示如何在 TextureView可以很方便地用来嵌入OpenGL场景的。 TextureView似乎更干净插入到相机preVIEW(套previewTexture)和MediaPlayer的(setSurface)。

Which seems to imply that to use TextureView instead of GLSurfaceView, one would have to do all the EGL setup themselves and manage the EGLContext and the threading (since GLSurfaceView maintains a GLThread). There doesn't seem to be any sample code in the Android 4.0 SDK that demonstrates how the "TextureView can just as easily be used to embed an OpenGL scene". TextureView seems to plug in more cleanly to the Camera preview (setPreviewTexture) and MediaPlayer (setSurface).

时有可能使用GLSurfaceView与TextureView结合使用GLSurfaceView.setEGLWindowSurfaceFactory使其呈现到TextureView的表面纹理?

Is it possible to use GLSurfaceView in conjunction with TextureView by using GLSurfaceView.setEGLWindowSurfaceFactory to make it render to the TextureView's SurfaceTexture?

此外,这将是很好,如果有一些样品code。

Again, it would be nice if there were some sample code.

推荐答案

请参阅罗曼盖伊的回答对android-dev的谷歌组:

See Romain Guy's answer on the android-dev google group:

<一个href="http://groups.google.com/group/android-developers/browse_thread/thread/539457146a401cf1">http://groups.google.com/group/android-developers/browse_thread/thread/539457146a401cf1

这篇关于如何在Android的冰淇淋三明治替代GLSurfaceView与TextureView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆