Learn something new every day
More Info... by email
In computer graphics programming, immediate mode is a rendering state in which the normal sequence of actions, and the framework in which they exist, are completely bypassed and, in some cases, deactivated. This means the application being run needs to directly call the functions necessary to show anything on a display device such as a monitor instead of relying on innate cycles outside the program. Immediate mode is most often used for programs that require the fastest possible render times, such as multimedia applications or video games, or is used as a teaching tool when learning how to use complex graphical libraries. A poorly designed or improperly implemented program that uses immediate mode rendering can cause blank screens or blank areas of a screen to appear and persist, because no automatic calls are made to redraw the current frame if needed. One variation is known as mixed mode, in which a program keeps the retained rendering framework in place while attempting to control certain parts of it through immediate mode style functions.
In many computer applications, rendering information or graphics to a display device is performed through event-driven program architecture. This means the screen is redrawn only in response to some type of input from a program or the user. This works well for programs such as word processors or web browsers, but it does not work for applications such as multimedia players, artistic rendering software or video games in which a screen might need to be redrawn 60 or more times each second without any type of input. The solution is to use immediate mode.
Instead of allowing an operating system or graphics library to control when and how a display is updated and rendered, the program takes complete control, removing any barriers between the display device and the application code. In this way, a program can create its own display loop, using timers and other custom code, so the screen is redrawn as many or as few times as is necessary to achieve the desired result. One complication in using immediate mode is that some of the transparent features of retained mode rendering — such as a geometry engine — might not be available, requiring the application to have its own implementations. Another issue is that a program can require a large amount of processing power to maintain the rendering loop at an acceptable speed.
An alternative to using immediate mode exclusively is to use a mixed rendering mode. In this design, the retained mode rendering framework is kept in place so all the functionality of a graphics library can be used, but certain functions or methods are overridden and replaced with user-generated code that can force the existing rendering framework to operate in a way that is more like immediate mode. This method can be effective, but it also can create code that is difficult to debug and could have unexpected results, depending on how the user code and the library code interact.