2

我正在使用 web 的 flash builder 创建一个宝石风格的游戏,我想知道是否最好使用 actionscript 3 的本机渲染(显示列表)或Starling 2D 框架的 gpu 渲染?我想要使​​用本机 Flash 渲染的原因是,根据我的研究,我了解到 Flash 将利用重绘区域,并且只重绘需要更新的阶段部分,而 Starling 将在每一帧重新渲染整个阶段。在宝石风格的游戏中,静态对象多而动态对象少,因此通常不需要每帧重绘整个舞台,只需要重新绘制舞台的一小部分。坚持使用 actionscript 3 的本机渲染调用会更好地提高性能,还是使用 starling 框架来利用 gpu 来加速渲染会更明智?任何观点将不胜感激。谢谢。

4

1 回答 1

3

Starling will be faster if you are using images, particularly on mobile.

The static regions can either be rendered as a single Sprite, or you can flatten it at runtime to improve the performance.

If you are drawing, in Starling you'll need to draw to a bitmap and then use that as a Sprite. You'll get better performance if everything is in the same sprite sheet, however.

While it's true that Starling draws every frame, it's a different sort of operation. Here's what actually happens:

1) The textures (images) being used by the app are uploaded to the GPU. This is done once.

2) Each frame, Starling tells the GPU "render this texture at this position with this scale and rotation". This is called a "draw call" but it's extremely fast. The slick thing with Starling is that it can batch these draw calls under certain circumstances to get serious speed improvements.

So yes, everything is "redrawn" each frame, but the GPU's hardware acceleration is used.

On mobile, Starling (or similar) is really the only way to do something at 60fps.

于 2012-11-20T15:56:54.840 回答