GLSurfaceView 之上的 Android 视图动画速度很慢
我们注意到,当您将带有视图动画(没什么复杂的,只是 AlphaAnimation 和 TranslateAnimation)的 Android 视图放在 GLSurfaceView 之上时,动画运行缓慢(即您会看到很多卡顿。)我在GLSurfaceView,我相信我已经确认(通过设置断点)动画播放时 GL 绘制调用不会受到影响,所以我不确定速度缓慢来自何处。
有谁知道解决这个问题的方法吗?我知道在 iPhone 上这也曾经是一个问题,但他们进行了一些操作系统更新来解决这个问题。它们是短视动画(例如,你赢了!),所以这不是世界上最糟糕的事情,但如果有一些解决方法那就太好了。
我们不在 GL 中制作动画的原因是它们必须能够从游戏中的任何 Activity 运行,并且并非所有 Activity 都有 GLSurfaceView。
最后,如果重要的话,我们将使用来自 Replica Island http://code.google 的修改后的 GLSurfaceView 源。 com/p/replicaisland/
We've noticed that when you put Android views with view animation (nothing complex, just AlphaAnimation and TranslateAnimation) on top of a GLSurfaceView, the animation runs slowly (i.e. you see a lot of stuttering.) I am calling pause() on the GLSurfaceView, and I believe I've confirmed (through setting breakpoints) that the GL draw calls are not getting hit while the animation is playing, so I'm not sure where the slowness is coming from.
Does anyone know of a way around this? I know that on iPhone this also used to be a problem, but there was some OS update they made to fix the issue. They are short view animations (e.g. You Win!) so it's not the worst thing in the world, but it would be nice if there was some workaround.
The reason we are not doing the animations in GL is that they have to be able to run from any Activity in our game, and not all of our Activities have GLSurfaceViews.
Finally, if it matters, we am using the modified GLSurfaceView source from Replica Island http://code.google.com/p/replicaisland/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 GLSurfaceView 上绘图很慢,因此动画也很慢。您迫使框架做更多的工作来确定表面视图的哪些部分是可见的。
当您使用表面视图时,您确实应该考虑在表面视图内执行这些动画。
另一种方法是将动画放在活动上方的小窗口中。
Drawing on top of a GLSurfaceView is slow, therefore animating is as well. You are forcing the framework to do more work to determine what part of the surface view is visible.
You should really consider doing these animations inside the surface view when you are using a surface view.
An alternative is to put the animation in a small window above your activity.