SurfaceTexture AttachToGLContext和Surface [英] SurfaceTexture AttachToGLContext and Surface

查看:1250
本文介绍了SurfaceTexture AttachToGLContext和Surface的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果要从SurfaceTexture调用attachToGLContext方法,我试图找出是否需要重新制作Surface.我试图查看android文档,但没有提及.

I'm trying to find out whether I need to remake a Surface if I want to call the attachToGLContext method from a SurfaceTexture. I tried to look in the android documentation, but there is no mention.

我猜不是因为据我所知,Surface是SurfaceTexture的缓冲区,可以充当OpenGL上下文的外部纹理.因此,将SurfaceTexture附加到其他上下文应该不会对此产生影响.

I'm guessing not because as far as I'm aware, Surface is a buffer for a SurfaceTexture which can act as an external texture for an OpenGL context. So attaching the SurfaceTexture to a different context should not affect this.

有人肯定知道吗?

推荐答案

SurfaceTexture的内部名称是"GLConsumer".曲面具有生产者与消费者的关系,而SurfaceTexture是使用者,它将获取的所有东西用作GLES纹理.

The internal name for SurfaceTexture is "GLConsumer". Surfaces have a producer-consumer relationship, and SurfaceTexture is a consumer that takes whatever it gets and makes it available as a GLES texture.

附加到它的Surface(通常通过使用以SurfaceTexture作为参数的Surface构造函数)是生产方.尽管在生产者和消费者之间的通信中有很多缓冲区,但是将Surface描述为缓冲区"并不是很准确.它更像是一个将图形数据发送给使用者的通信端点.

The Surface attached to it (usually by using the Surface constructor that takes a SurfaceTexture as an argument) is the producer side. While there is a queue of buffers involved in the communication between the producer and the consumer, it's not really accurate to describe the Surface as "a buffer". It's more like a communication endpoint that sends graphics data to the consumer.

更改与消费者方关联的EGL上下文对生产者方没有影响. Attach/detach调用不会断开生产者的连接.它们只会影响SurfaceTexture对其接收到的数据缓冲区的处理方式.

Changing the EGL context associated with the consumer side will have no effect on the producer side. The attach / detach calls do not disconnect the producer. They only affect what the SurfaceTexture does with the buffers of data it receives.

但是,使用这些调用是非常不寻常的,并且操纵EGL上下文可能会产生一些开销,因此请确保它是您所需要的.

It's fairly unusual to need to use these calls though, and there may be some overhead associated with manipulating EGL contexts, so make sure it's what you need.

这篇关于SurfaceTexture AttachToGLContext和Surface的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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