How to install OpenGL/GLUT libraries

I currently installed ubuntu 11.10 on my acer netbook. I have problem getting some packages I need. I am using the most updated version and have a wifi connection on my campus. This is what my instructor wishes for us to do:

  1. select Applications/Accessories/Terminal on the Ubuntu desktop
  2. type ls /usr/include/GL
    if glut.h gl.h etc are there, great
    if not, install it sudo apt-get install libglut3-dev
  3. I then copied program1.c to the desktop
  4. cd desktop
  5. gcc -lglut -lGLU program1.c note l is a lower-case L, which means library in UNIX
  6. ./a.out to execute

I complete step 2, in which returns:

sudo: ls/brandon/include/GL: command not found

so from here I do the apt-get and try to install it but returns me with this:

E: Unable to locate package libglut3-dev

Does this have to do with my connection or is there something I need to be doing on my system for it to find the package and install it. I'm really new to ubuntu and could use some help just getting started.


Solution 1:

Your instructions seem to be old, as far as I know glut is provided by the package freeglut3, to get it with the header files for development, install:

sudo apt-get install freeglut3-dev

freeglut3-devInstall freeglut3-dev

which should also pull in freeglut3Install freeglut3.

To have found this on your own, you could have done:

sudo apt-cache search glut

After you have installed package freeglut3-dev you can confirm it contains the needed GL files by issuing

dpkg -L freeglut3-dev

which will list contents of the package which include :

/usr/include/GL
/usr/include/GL/freeglut.h
/usr/include/GL/freeglut_ext.h
/usr/include/GL/freeglut_std.h
/usr/include/GL/glut.h
/usr/lib/x86_64-linux-gnu/libglut.a
...
/usr/lib/x86_64-linux-gnu/libglut.so

Solution 2:

To install OpenGL libraries:

sudo apt-get install mesa-utils

To install freeGlut:

sudo apt-get install freeglut3-dev