This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Retained mode" – news · newspapers · books · scholar · JSTOR (September 2014) (Learn how and when to remove this message) |
Retained mode in computer graphics is a major pattern of API design in graphics libraries, in which
- the graphics library, instead of the client, retains the scene (complete object model of the rendering primitives) to be rendered and
- the client calls into the graphics library do not directly cause actual rendering, but make use of extensive indirection to resources, managed – thus retained – by the graphics library. It does not preclude the use of double-buffering.
Immediate mode is an alternative approach. Historically, retained mode has been the dominant style in GUI libraries; however, both can coexist in the same library and are not necessarily exclusionary in practice.
Overview
In retained mode the client calls do not directly cause actual rendering, but instead update an abstract internal model (typically a list of objects) which is maintained within the library's data space. This allows the library to optimize when actual rendering takes place along with the processing of related objects.
Some techniques to optimize rendering include:
- managing double buffering
- treatment of hidden surfaces by backface culling/occlusion culling (Z-buffering)
- only transferring data that has changed from one frame to the next from the application to the library
Example of coexistence with immediate mode in the same library is OpenGL. OpenGL has immediate mode functions that can use previously defined server side objects (textures, vertex buffers and index buffers, shaders, etc.) without resending unchanged data.
Examples of retained mode rendering systems include Windows Presentation Foundation, SceneKit on macOS, and PHIGS.
See also
References
- Jin, Zhefan (May 2006). "Retained-Mode Parallel Graphics Rendering for Cooperative Design Environments". 2006 10th International Conference on Computer Supported Cooperative Work in Design. pp. 1–6. doi:10.1109/CSCWD.2006.253142. ISBN 1-4244-0164-X. S2CID 5825966.
- ^ Quinn Radich (May 30, 2018). "Retained Mode Versus Immediate Mode". Win32 apps. Microsoft. Retrieved 21 December 2019.
- stevewhims. "Predication queries - Win32 apps". learn.microsoft.com. Retrieved 2022-12-09.
- Feldmeier, Alex (October 12, 2013). "GUI Programming". UWP Computer Science and Software Engineering Technical Report. Retrieved 22 December 2019.
Retained mode has been the standard for years. Just about every GUI is in retained mode.
- QuinnRadich. "Retained Mode Versus Immediate Mode - Win32 apps". docs.microsoft.com. Retrieved 2020-08-21.
- "OpenGL double buffering". Retrieved 7 May 2020.
- "DirectX double buffering". Retrieved 7 May 2020.
- "OpenGL face culling". Retrieved 7 May 2020.
- "DirectX occlusion culling". Retrieved 7 May 2020.
- "OpenGL". Retrieved 4 May 2020.
- "OpenGL Driver Support". NVIDIA Developer. 2013-08-19. Retrieved 2020-08-21.
- "OpenGL - The Industry's Foundation for High Performance Graphics". The Khronos Group. 2011-07-19. Retrieved 2020-08-21.
- Weiher, Marcel (Feb 24, 2017). iOS and macOS Performance Tuning: Cocoa, Cocoa Touch, Objective-C, and Swift. Addison-Wesley Professional. ISBN 9780133085532. Retrieved 22 December 2019.
SceneKit and SpriteKit on the other hand are retained-mode APIs