OpenGL Programming/Installation/Linux

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Contents

[edit] OpenGL Installation on Linux

Installations of all kinds on Linux are highly dependent on distribution. Referring to your distro's packages can save you a lot of time and headache in installation. For example, on Debian-based distros (with apt-get or equivalent installed), you can use the comands:

sudo apt-get update
sudo apt-get install libgl1-mesa-dev

to install the header files of OpenGL libraries. Nevertheless:

[edit] Headers

Headers compatible with OpenGL are available from the Mesa3D project. In the unlikely event that your distribution does not contain development files for the Mesa3D project, Mesa3D comes equipped with the usual

 ./configure
 make
 make install

installation procedure; however, BE CAREFUL OF CONFLICTING OPENGL LIBRARIES.

Mesa's software implementation may override your distribution's libraries or libraries manually installed, such as the nVidia or fglrx OpenGL binaries. When this happens, search (slocate or find) all directories listed in /etc/ld.so.conf for libGL.so. Multiple copies of libGL.so under the LD_LIBRARY_PATH, if not referring to the same file, usually indicates a conflict. Remove all but the copy you want executed.

The headers will be installed to [install_root]/include/GL - on Debian systems, this is /usr/local/include/GL when compiled from source or /usr/include/GL when installed from a pre-built package.

"Official" OpenGL headers are available from SGI, however, they are hopelessly out of date.

[edit] Drivers

OpenGL is the primary 3D graphics API on Linux-based systems. If your device supports 3D acceleration on Linux, it probably includes an OpenGL distribution.

[edit] Closed-Source Options

nVidia provides generally excellent but closed-source drivers via the nvidia driver from their website. Fglrx drives many modern ATI devices; it is also closed-source, and available from ATI's website.

[edit] Open-Source Options

The open-source nv driver also supports nVidia chipsets, but at the time of writing is nowhere near as complete as nVidia's closed-source drivers. A new attempt to make a free accelerated driver, nouveau, under the DRI framework is in the works -- this is not the same as the nv driver, and already has come a lot longer. (FIXME reference nv driver)

Currently, some older ATI chips will run well with the open source radeon driver. If you have a newer chip, you may be forced to use the mediocre fglrx driver. AMD has recently released the specifications for their chips, so a new driver, radeon-hd, should become usable in the few months.

(FIXME reference other drivers)

The OpenGL driver on Linux systems consists of two files:

  • libGL.so for the GL itself; libGL.so must be in the accessible to the Linux library loader (refer to man pages for ldconfig)
  • glx.so (this name may vary) for Xorg support for OpenGL; glx.so will be in Xorg's extensions path and must be loaded by xorg.conf (refer to man pages for xorg.conf)

Many OpenGL applications require libGLU.so as well; GLU operations are not hardware-accelerated, so the implementation provided by Mesa is an excellent option.

[edit] See Also