Flash Player 2种渲染模式(Retained模式,Immediate模式)

Retained模式
 高端模式,AS3是Retained Mode
 能够成为跨越Adobe产品功能的标准
 分离渲染本身和功能依赖要求,如GPU,Cell等
 能够分离处理的类型,如video,audio
 在渲染计算中以表面特征出现(Surfaces)
 BitmapData,Filters,cacheAsBitmap都是表面特征
 Bitmap本身会被独立保留
 解决了渲染模式中的不连续性
 体系庞大
 难于维护和保持兼容性
Immediate模式
 底层模式
 灵活
 易于维护及保持兼容
 缺点
 绑定了功能到底层语言与硬件驱动
 结论
 Pixel Bender使用Immediate模式
 GPU加速使用Immediate模式
 分离为表象的部分使用Immediate模式
 Bitmap和其他"lls填充为Retained模式
 AS3是Retained模式
 两者混合可以优化Binary下的Retained效率

 

参考资料:Retained and Immediate Modes
A graphics system operates in retained mode if it retains a copy of all the data describing a model. In other words, a retained mode graphics system requires you to completely specify a model by passing model data to the system using predefined data structures. The graphics system organizes the data internally, usually in a hierarchical database. Once an object is added to that database, you can change the object only by calling specific editing routines provided by the graphics system.

By contrast, a graphics system operates in immediate mode if the application itself maintains the data that describe a model. For example, original QuickDraw is a two-dimensional graphics system that operates in immediate mode. You draw objects on the screen, using QuickDraw, by calling routines that completely specify the objects to be drawn. QuickDraw does not maintain any information about a picture internally; it simply takes the data provided by the application and immediately draws the appropriate objects.

OpenGL is an example of a 3D graphics system that operates in immediate mode. QuickDraw GX is an example of a 2D graphics system that operates in retained mode.

QuickDraw 3D supports both immediate and retained modes of specifying and drawing models. The principal advantage of immediate mode imaging is that the model data is immediately available to you and is not duplicated by the graphics system. The data is stored in whatever form you like, and you can change that data at any time. The main disadvantage of immediate mode imaging is that you need to maintain the sometimes quite lengthy object data, and you need to perform geometric operations on that data yourself. In addition, it can be difficult to accelerate immediate mode rendering, because you generally need to specify the entire model to draw a single frame, whether or not the entire model has changed since the previous frame. This can involve passing large amounts of data to the graphics system.

Retained mode imaging typically supports higher levels of abstraction than immediate mode imaging and is more amenable to hardware acceleration and caching. In addition, the hierarchical arrangement of the model data allows the graphics system to perform very quick updates whenever the data is altered. To avoid duplicating data between your application and the graphics system's database, your application should match the data types of the graphics system and use the extensive editing functions to change a model's data.

Another important advantage of retained mode imaging is that it's very easy to read and write retained objects.

To create a point, for example, in retained mode, you fill in a data structure of type TQ3PointData and pass it to the Q3Point_New function. This function copies the data in that structure and returns an object of type TQ3GeometryObject , which you use for all subsequent operations on the point. For example, to draw the point in retained mode, you pass that geometric object returned by Q3Point_New to the Q3Geometry_Submit function inside a rendering loop. To change the data associated with the point, you call point-editing functions, such as Q3Point_GetPosition and Q3Point_SetPosition . Finally, when you have finished using the point, you must call Q3Object_Dispose to have QuickDraw 3D delete the point from its internal database.

It's much simpler to draw a point in immediate mode. You do not need to call any QuickDraw 3D routine to create a point in immediate mode; instead, you merely have to maintain the point data yourself, typically in a structure of type TQ3PointData . To draw a point in immediate mode, you call the Q3Point_Submit function, passing it a pointer to that structure. When you're using immediate mode, however, you need to know exactly what types of objects you're drawing and hard code the appropriate routines in your source code.

Immediate mode rendering does not require any memory permanently allocated to QuickDraw 3D, but it might require QuickDraw 3D to perform temporary allocations while rendering is occurring.

In general, if most of a model remains unchanged from frame to frame, you should use retained mode imaging to create and draw the model. If, however, many parts of the model do change from frame to frame, you should probably use immediate mode imaging, creating and rendering a model on a shape-by-shape basis. You can, of course, use a combination of retained and immediate mode imaging: you can create retained objects for the parts of a model that remain static and draw quickly changing objects in immediate mode.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值