Misplaced Pages

Immediate mode (computer graphics)

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Graphics libraries API design pattern Not to be confused with direct mode, referring to the input of textual commands outside the context of a program.
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: "Immediate mode" computer graphics – news · newspapers · books · scholar · JSTOR (December 2019) (Learn how and when to remove this message)

Immediate mode is an API design pattern in computer graphics libraries, in which

without the use of extensive indirection – thus immediate – to retained resources. It does not preclude the use of double-buffering.

Retained 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 exclusive in practice.

Overview

Schematic explanation of an immediate mode graphics API

In immediate mode, the scene (complete object model of the rendering primitives) is retained in the memory space of the client, instead of the graphics library. This implies that in an immediate mode application, the lists of graphical objects to be rendered are kept by the client and are not saved by the graphics library API. The application must re-issue all drawing commands required to describe the entire scene each time a new frame is required, regardless of actual changes. This method provides on the one hand a maximum of control and flexibility to the application program, but on the other hand it also generates continuous work load on the CPU.

Schematic explanation of a retained mode graphics API in contrast

Examples of immediate mode rendering systems include Direct2D, OpenGL and Quartz. There are some immediate mode GUIs that are particularly suitable when used in conjunction with immediate mode rendering systems.

Immediate mode primitive rendering

Primitive vertex attribute data may be inserted frame by frame into a command buffer by a rendering API. This involves significant bandwidth and processor time (especially if the graphics processing unit is on a separate bus), but may be advantageous for data generated dynamically by the CPU. It is less common since the advent of increasingly versatile shaders, with which a graphics processing unit may generate increasingly complex effects without the need for CPU intervention.

Immediate mode rendering with vertex buffers

Although drawing commands have to be re-issued for each new frame, modern systems using this method are generally able to avoid the unnecessary duplication of more memory-intensive display data by referring to that unchanging data (via indirection) (e.g. textures and vertex buffers) in the drawing commands.

Immediate mode GUI

Graphical user interfaces traditionally use retained mode-style API design, but immediate mode GUIs instead use an immediate mode-style API design, in which user code directly specifies the GUI elements to draw in the user input loop. For example, rather than having a CreateButton() function that a user would call once to instantiate a button, an immediate-mode GUI API may have a DoButton() function which should be called whenever the button should be on screen. The technique was developed by Casey Muratori in 2002. It is e.g. implemented in Nic Barker's clay library.

See also

References

  1. ^ Quinn Radich (May 30, 2018). "Retained Mode Versus Immediate Mode". Win32 apps. Microsoft. Retrieved 21 December 2019.
  2. ^ 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.
  3. "OpenGL". Retrieved 4 May 2020.
  4. 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. The primary graphics API Quartz and OpenGL are both immediate-mode APIs
  5. ^ Barrett, Sean (September 2005). "Immediate Mode GUIs" (PDF). Game Developer. Vol. 12. pp. 34–36. Retrieved 14 February 2021.
  6. ^ "Immediate-Mode Graphical User Interfaces (2005)". Immediate-Mode Graphical User Interfaces (2005). Retrieved 2021-06-15.
  7. https://nicbarker.com/clay
  8. "Introducing Clay - High Performance UI Layout in C". Retrieved 2024-12-20.
Categories: