[英]Keep surface upon orientation change (using GLSurfaceView)
I'm trying to keep some rendering going on (without resetting it) even upon destroy and re-creation of my activity (due to an orientation change).即使在破坏和重新创建我的活动(由于方向改变)时,我也试图保持一些渲染(不重置它)。
I took a look into Grafika 's DoubleDecodeActivity , which is very clarifying on how to do it.我查看了Grafika的DoubleDecodeActivity ,它非常清楚地说明了如何去做。 However, it does it by using a
TextureView
, which is less efficient, since the drawn frames don't get passed directly to the surface compositor (SurfaceFlinger).但是,它通过使用
TextureView
,但效率较低,因为绘制的帧不会直接传递给表面合成器 (SurfaceFlinger)。 My user experience becomes compromised.我的用户体验受到了影响。 What I need is a
GLSurfaceView
(or maybe a SurfaceView
).我需要的是
GLSurfaceView
(或者可能是SurfaceView
)。
The problem is I don't know how to persist the SurfaceView
's " SurfaceTexture
" (if that's a thing) across different instances of my activity.问题是我不知道如何在我的活动的不同实例中保留
SurfaceView
的“ SurfaceTexture
”(如果是这样的话)。
Can someone please help me out with this?有人可以帮我解决这个问题吗?
Following your line of reasoning I think if you render to a TextureView instead of directly in the GLSurfaceView you can achieve the desired behavior.按照您的推理思路,我认为如果您渲染到 TextureView 而不是直接在 GLSurfaceView 中,您可以实现所需的行为。
Please take a look at https://github.com/google/grafika/blob/master/app/src/main/java/com/android/grafika/TextureViewGLActivity.java请看一下https://github.com/google/grafika/blob/master/app/src/main/java/com/android/grafika/TextureViewGLActivity.java
Best Regards此致
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.