Install OpenGL on Linux

Ok, I am posting after a really long time. Had been busy with some stuff (not limited to the ACM chapter Chairmanship).

Also college has resumed and I have started 3rd year with Computer Graphics as my elective subject. Now the issue of installing OpenGL, the best 3D graphics API out there, on linux arrives.

Well here’s the good news: OpenGL ships with most Linux distros, and Ubuntu is one of them. The Bad news: Getting glut for the X-Window system.

Here’s the solution: You can either go get freeglut and follow the install instructions, which is a very good idea, with a few modifications:

  1. Use ‘tar’ directly instead of bzip as specified on the site.
  2. Go to your package manager and be sure to install the “libxi-dev” package. You’ll need it to get the makefile.
  3. Continue with the normal installation process.

Else, you can run this command in a terminal window:

 sudo apt-get install libglut3-dev 

That should install glut (or freeglut, as is the case) and get you ready to write some deadly graphics code. Just compile and build with

 g++ -lglut -lGLU yourProgram.cpp -o yourProgram 

to get the executable and enjoy the show.