Whole document tree
    

Whole document tree

Libraries

3. Libraries

We'll run through the different gaming libraries you'll see under Linux.

3.3. What is OpenGL?

OpenGL is a high level graphics programming API originally developed by SGI, and it became an industry standard for 2D and 3D graphics programming. It is defined and maintained by the Architectural Revision Board (ARB), an organization whose include SGI, IBM, DEC, and Microsoft. OpenGL provides a powerful, complete and generic feature set for 2D and 3D graphics operations.

There are 3 canonical parts to OpenGL:

OpenGL is not only an API, it's also an implementation, written by SGI. The implementation tries to use hardware acceleration for various graphics operations whenever available, which depends on what videocard you have in you computer. If hardware acceleration is not possible for a specific task, OpenGL falls back on software rendering. This means that when you get OpenGL from SGI, if you want any kind of hardware acceleration at all, it must be OpenGL written and compiled specifically for some graphics card. Otherwise, all you'll get is software rendering. The same thing is true for OpenGL clones, like Mesa.

OpenGL is the open source equivalent to Direct3D (a component of DirectX). The important difference being that since OpenGL is open (and DirectX is closed), games written in OpenGL are much easier to port to Linux while games written using DirectX at this point in time are impossible to port to Linux.

3.11. What is SVGAlib? Frame buffer? Console?

The console is the dark non-graphical screen you look at when your computer first boots up (and you don't have have xdm or gdm running). This is opposed to the X environment which has all sorts of GUI things like xterms. It's a common misconception that X means graphics and console means no graphics. There are certainly graphics on the console—we will discuss the two most common ways to achieve this.

SVGAlib is a graphics library that lets you draw graphics on the the console. There are many graphical applications and games that use SVGAlib like zgv (a console graphical image viewer), prboom and hhexen. I happen to be a fan of this library and of graphical console games in general; they are extremely fast, fullscreen and compelling. There are three downsides to SVGAlib. First, SVGAlib executables need to be run by root or be setuid root, however, the library releases root status immediately after the executable begins to run. Secondly, SVGAlib is video card dependent–if your video card isn't supported by SVGAlib, you're out of luck. Third, SVGAlib is Linux only. Games written in SVGAlib will only work on Linux.

Frame buffers are consoles implemented by a graphics mode rather than a BIOS text mode. Why would you want to simulate text mode from a graphical environment? This allows us to run graphical things in console, like allowing us to choose what font we want the console to display (which is normally determined by BIOS). Imagine having a console font of Comic Sans MS? There's a good Frame Buffer howto available from LDP.

3.13. What is DirectX?

DirectX is a bunch of multimedia (2d and 3d graphics, sound, animation) API's for Microsoft's Windows OS, first developed by MS in 1995. Direct3D is to MS Windows as SDL is to Linux, except that Direct3D proprietary, closed source, very high level and only meant to compile and be used under Windows under the x86 architecture, whereas SDL is open source, lower level and extremely portable to other platforms. As of February 2002, the most recent version of DirectX is 8.1. The component of DirectX which is responsible for 3D graphics is called Direct3D.

We mention it here because it is a competing technology to open technologies like SDL and OpenGL/OpenAL. Many games have, historically, been unportable to Linux because they have been written in Direct3D. However, recently there have been Direct3D ports to Linux like Loki Software's Heavy Gear II. Also, Direct3D is important to people who play Windows games under Linux via wine, winex or one of the virtual machines like vmware. In particular, the whole point of winex is to provide better support for Direct3D which isn't very developed under plain wine.

A company named realtechVR started an open source project called the "DirectX Port" <http://www.v3x.net/directx> which, like wine, provides a Direct3D emulation layer that implements Direct3D calls. The project was focused on the BeOS platform, but is now focused on MacOS and Linux. The DirectX Port is open source and you can get their latest cvs from their sourceforge page at http://sourceforge.net/projects/dxglwrap>.