Using GLUT (OpenGL Utility Toolkit) in Linux

After years of programming with Microsoft Visual Studio, I decided to move to Linux programming. I found that it is a lot easier to use and find information for additional libraries. GLUT, for example, can be installed as a package from the repository. Without having to locate each library file, and no need to configure the project properties manually, I am very happy with my move.

This instruction is to compile GLUT (OpenGL Utility Toolkit) library on Ubuntu, but other debian distros should work too. First you need to install the package freeglut3-dev. One way to do this is by typing:

$ sudo apt-get install freeglut3-dev

After we install this package, we are ready to use GLUT library. Try to compile the file hello.c.

To compile this program, use the command line:

$ gcc hello.c -o hello -I/usr/X11R6/include/ -L/usr/X11R6/lib -lglut -lGL -lGLU

To run the program, use the command line:

$ ./hello