简体   繁体   English

在方向改变时保持表面(使用 GLSurfaceView)

[英]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.我查看了GrafikaDoubleDecodeActivity ,它非常清楚地说明了如何去做。 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.

相关问题 GLSurfaceView中的方向更改问题 - Orientation Change problems in GLSurfaceView Android:方向更改后自定义曲面视图崩溃 - Android: Custom Surface View crashing upon orientation change MediaRecorder-使用GLSurfaceView的SurfaceTexture中的新Surface作为预览时,帧速率减速到抓取 - MediaRecorder - framerate decelerates to a crawl upon using new Surface from the GLSurfaceView's SurfaceTexture as the preview 保持AutoCompleteTextView的值不会在方向更改时重置 - Keep values of AutoCompleteTextView from resetting upon orientation change GLSurfaceView 在设备旋转/方向更改时崩溃 - NullPointerException - GLSurfaceView crashes on device rotation / orientation change - NullPointerException NavController 在方向改变时崩溃 - NavController crashes upon orientation change 方向更改时文件未保存 - File not being saved upon orientation change 方向改变时片段堆栈的行为 - Behavior of fragments stack upon orientation change FragmentPagerAdapter无法在Orientation Change上恢复片段 - FragmentPagerAdapter not restoring fragments upon Orientation Change 方向更改后在PagerAdapter中保存EditText的状态 - Save state of EditText in PagerAdapter upon orientation change
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM