Graphics applications are concurrent and distributed systems, and many patterns of concurrent and distributed programming apply to interactive graphical programs.
Architecture of A Graphics System
Modern graphical computer systems are organised as a display manager that shares the display surface between multiple client applications. Clients communicate with the display manager by message passing, sending drawing requests or queries and receiving replies or user-input events. Some graphics systems, such as X11 (Xwindow Protocol, www.x.org , www.xfree86.org ), Network Extensible Window System, QNX's Photon microGUI (www.qnx.com ) or OpenGL/GLX (www.opengl.org ), can pass the messages over the network. Others, such as the GUI components of Windows NT, pass the messages between processes on the same host. Either way, communication costs are a bottleneck in graphics applications and must be minimised to achieve acceptable interactive performance.
The display manager runs concurrently with the display hardware and communicates with it via the graphics card. The display manager writes to the the display memory in the card, and the hardware reads the display memory as the scanline moves down the monitor. The display manager and the display hardware must synchronise to avoid flicker and tearing in the generated graphics. These synchronisation costs must be minimised to achieve acceptable interactive performance.
The communication protocol between the display manager and its clients is too complex to be used directly. Access to the protocol is usually provided by a procedural API, such as XLib or the Win32 GDI, where procedures map quite directly to communication messages passed between client and server. These APIs typically contain hundreds of access functions. However, graphical displays have a natural object-oriented representation, and so the lower level API can be wrapped in a convenient class library or framework.
Patterns of programming graphics and animation.
Representing Graphical Displays as Objects
Implementing Interactivity
Drawing
Refresh Rectangles, also known as Dirty Rectangles
Abstract Session Pattern is used to maintain multiple drawing contexts for the same display surface.
Pages about or clarifying the patterns
See original on c2.com