The Puzzle of 3-D Graphics on Linux

New opportunities for game developers are provided by several tools.

Over the past year, there has been a drastic change in how Linux is viewed by gamers. No longer relegated to the role of just a dedicated server, gamers are using Linux in increasing numbers as their primary OS and as their gaming platform. And as if using Linux wasn't a challenge enough in itself, anyone trying to set up a Linux box to play a 3-D game will find the path fraught with a plethora of confusing acronyms and names. From OpenGL to DRI to DGA, each term refers to a particular part of the full scene of Linux graphics. Here we put those pieces together for our readers to give them a broader view of what Linux has to offer now and what it will offer, in the near future.

Figure 1. Heavy Gear II and Quake III Running Simultaneously

What is OpenGL?

We start by looking at OpenGL, a name that's gotten a lot of use lately, especially in reference to games and professional design applications. Originally called IRIS GL, OpenGL (Open Graphics Library) is a programming library that provides a rich array of graphics functions, both 2-D and 3-D, allowing the programmer to represent any object they design on the screen. It was developed by Silicon Graphics (SGI) and has become a standard graphics application programming interface (API) on many platforms including UNIX, Linux, Microsoft Windows and Apple Macintosh. While OpenGL is the standard for high-end graphics applications where programmers have found it powerful and easy to use, most people have heard of OpenGL in reference to the Quake series of games from id Software. It has been used as part of the graphics renderer since Quake 1, where it has shown itself to be a powerful game graphics API as well. The standard for OpenGL is an open one, independent of hardware platforms, windowing systems and operating systems. Thus the word “Open” as part of the name.

In order for OpenGL to be used in an OS, someone must create a library to implement the function calls OpenGL programs make. However, to call your implementation by the name “OpenGL”, you must actually obtain a license from SGI (or Microsoft). In fact, getting a license will earn you a package of code, called a Sample Implementation and written in C, from which you can build your OpenGL library on your platform. But since the standard for OpenGL is an open one, working from the SI isn't required. In fact, that's what Mesa is all about: it is an implementation created from scratch without a license from SGI and without any code from SGI. To use the OpenGL trademark, however, you must get a license from SGI and your implementation must be robust enough to pass a set of conformance tests developed by the OpenGL Architecture Review Board (ARB). The ARB historically consisted primarily of high-end hardware manufacturers and SGI itself, but now includes some game hardware manufacturers. It is worth noting that, while SGI created OpenGL, the future of the API is controlled by the ARB where SGI sits as one of many members.

Recently, SGI released a Sample Implementation (SI) that can be used to implement the API on any hardware platform with an appropriate compiler. This source code is very similar to the one sold to hardware vendors that implement OpenGL drivers for their video cards. While it has been said that the SI is now open-source software, this isn't entirely true. As of this writing, there are still some issues with the license attached to the SI that prevent it from being truly open.

Many people associate OpenGL with hardware acceleration. While it is true that OpenGL runs very quickly when it has hardware assistance, that acceleration is not required to run an OpenGL application. With a software OpenGL library, OpenGL applications can run and render the same image as they would with hardware acceleration, albeit significantly slower unless the program is very simple. When hardware acceleration is available (in the form of a 3-D graphics card and a driver written for that card), OpenGL applications can run very quickly and smoothly, since most of the intense operations have been offloaded from the CPU to the dedicated graphics board. However, not every accelerator has the ability to perform all the features of OpenGL. When a feature is not supported in hardware, the library may fall back to a software implementation which uses your CPU. For example, very few consumer-class video cards will do transform and lighting (T&L), so normal triangle setup is often done partially in hardware and the rest in software.

Since its initial creation, OpenGL has undergone several revisions and now stands at version 1.2.

In Linux, the implementation of OpenGL used most often is Mesa, created by Brian Paul.