作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我发现更改 SurfaceView 中的像素格式对帧速率有很大影响。但是,我似乎无法找到一种方法来根据每个设备选择最佳格式。
例子:
@Override
public void surfaceCreated(final SurfaceHolder holder) {
//This line seems to fix speed issue with his res devices
holder.setFormat(PixelFormat.RGBA_8888);
androidGame.setSurfaceHolder(holder);
}
这会导致我的游戏在 Galaxy Nexus (ICS 4.0) 上运行得更快,但在 Motorola Xoom (3.2.1) 上运行缓慢。
如果我更改为 PixelFormat.OPAQUE,情况就会相反。 Nexus 很慢,而 Xoom 现在很快。所以我需要能够确定每个设备的最佳格式。我尝试使用 getWindow().getAttributes().format 但这总是返回 -1(不透明)。
最佳答案
在 Google IO 2012 的办公时间内,我能够与 Romain Guy 交谈。不幸的是,没有合理的方法来检测要使用的最佳像素格式。您必须在每台设备上运行基准测试才能找到最佳格式。
关于android - 如何为 Android SurfaceView 找到最佳的 PixelFormat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8829943/
我是一名优秀的程序员,十分优秀!