Setting up an OpenGL Environment in Linux


Nitin Sonawane offers the following information on setting up an OpenGL Environment using the Mesa3d API.  Mesa3d complies in most respects with the standard OpenGL standard, and is certainly capable for anything that we will be doing in this course.

The most popular free openGL implementation seems to be the Mesa-3D graphics library (http://mesa3d.org). The web-page has detailed instructions on installation and downloading. I did the following:

- Download the files MesaLib-6.2.1.tar.bz2 & MesaDemos-6.2.1.tar.bz2 (6.2.1 is the latest version at this time).

- Extract both using the command "tar xvfj". This will create a directory "Mesa-6.2.1" with all the source and demo programs.

- CD to this directory and configure for Linux "make linux-x86"

- Type "make" to build everything.

- After compilation is complete, set the dynamic library path (preferrably in your .bash_profile) to point to the Mesa installation. In my case, "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/MesaLib-6.2.1/lib".

- Run a sample program from the "progs/demos" directory. If it runs successfully, install is complete. To compile openGL code, the Mesa directories have to be added as compiler flags. For your example program "hello.cpp", compiler command is "gcc -I $HOME/Mesa-6.2.1/include/GL -L $HOME/Mesa-6.2.1/lib -lglut hello.cpp -o hello".


Return to Graphics 1 Homepage