Android:在 SurfaceView 和 OpenGL 之间做出选择(GLSurfaceView) [英] Android: Deciding between SurfaceView and OpenGL (GLSurfaceView)

查看:22
本文介绍了Android:在 SurfaceView 和 OpenGL 之间做出选择(GLSurfaceView)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在规划阶段根据游戏/应用程序的预期复杂性预先决定是在 SurfaceView 中使用常规 Canvas 绘图还是使用 OpenGL?

我一直在玩画布,只需要 2D 运动,在一部相当新的手机上,我获得了相当不错的性能,一堆原始对象和一些位图在纯色背景上围绕屏幕运行.

公平地说,如果我要绘制背景图像并增加在它们之上移动和绘制的对象的数量,我应该直接使用 OpenGL 吗?

解决方案

我只能说这取决于你要使用多少精灵.来自 Google 的 Chris Pruett 也很好地记录了这一部分.

.

Is there a way to decide up front based on the expected complexity of a game/app in the planning phase whether to use regular Canvas drawing in a SurfaceView or to go with OpenGL?

I've been playing around with a Canvas and only need 2D movement, and on a fairly new phone I'm getting pretty decent performance with a bunch of primitive objects and a few bitmaps running around the screen on a solid background.

Is it fair to say that if I'm going to be drawing background images and increasing the number of objects being moved and drawn on top of them that I should go straight to OpenGL?

解决方案

All I can say is that it depends on how many sprites you're gonna use. Chris Pruett from Google has also documented this part very well.

Google I/O 2009 and Google I/O 2010.

Below is a picture from one of his slides that are related to your topic:

With that knowledge, you should go with OpenGL using the draw_texture extension. Remember to query out the string and check if draw_texture is supported on the actual device.

For further information that are related to game development in general, see this.

这篇关于Android:在 SurfaceView 和 OpenGL 之间做出选择(GLSurfaceView)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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