- Can See Right Through You
- Extra Damage
- Beautiful Text
- Special Effects
Special Effects
The big advantage of moving to a compositing approach for window display is the availability of translucent windows, and maybe shadows, but the extensions provide a lot more potential functionality.
The operations supported by the Render extension are often hardware-accelerated, giving very fast compositing, scaling, skewing, and rotating to X applications. The new acceleration architecture in X makes a lot of changes. Early graphics accelerators offloaded things such as drawing lines. Now, it tends to be faster to do this kind of thing on the CPU.
Things like compositing are still much faster on the GPU, however, but were not supported by the old driver framework. With the new acceleration architecture, EXA, composting is done in hardware.
So far, we have mainly looked at using these extensions for the whole desktop, but it’s also possible to use them within an application. The Render extension allows these transformations to be applied to polygons and images created by an application, which are then composited to the application’s window. This window is then composited onto the root window by the compositing manager.
The simplest application using this kind of facility is the new version of xclock. The xclock program has a long history, having been part of X since the very beginning. It displays an analog clock face, with triangles representing the hands.
In the latest version, the triangular hands are drawn using the Render extension, which antialiases them. They are also now different colors and are slightly translucent, making the blob in the middle where they overlap clearer.
The composite extension allows drawing to an off-screen buffer. This is then composited using the render extension. Since this is accelerated where possible, this means you get things like scaling of images for free. If you want to display a large number of image thumbnails, for example, you can use the CPU to decompress the originals and (assuming driver support) the GPU to perform the scaling.
This is taken a step further with support for accelerated indirect OpenGL over X (AIGLX). Traditionally, there were two ways of using OpenGL in X11. Using indirect GLX, the OpenGL commands were encapsulated into X11 commands and sent to the server, which did the rendering. With direct GLX, the X server would allocate an area of the screen where the results of OpenGL drawing would be displayed, and the hardware would draw there directly.
While SGI workstations accelerated both paths from the beginning, XFree86 and x.org used a slow software renderer for the indirect path. Now, both paths are accelerated, making it possible to use OpenGL in the compositing manager.
X11 has changed a lot since the ’80s. While it can still run the original xclock and xterm applications, a modern X server has a number of features that supersede most of the original drawing mechanisms. Between Composite, Render, Damage, Fixes, RandR, and AIGLX, X11 looks a lot like a modern windowing system.