Search Projects

Tuesday, November 25, 2014

How to install opengl in linux ubuntu

Executing the OpenGL Programs in Windows is quite easy as compare executing it with the Linux OS. You just need to install the Visual studio in windows machine and paste the right file in proper folder. But in Linux (Ubuntu) that not as easy, this is thought of many students.While this wrong assumption, Linux may be little hard to execute as it need more a programmatic approach rather than a simple use of GUI. There are many of students feel difficult to install the OpenGL/Glut libraries in Ubuntu or any Linux. Here we are going to learn how to install the OpenGL/Glut libraries in your Desktop or PC to execute the OpenGL Programs in C/C++ Computer graphics.

How to Install OpenGL/Glut libraries in Ubuntu/Linux

Download OpenGL/Glut in Ubuntu/Linux:


1. The first step is to open terminal using CTRL+ALT+T command.
2. Now install the development libraries of OpenGL/Glut in Ubuntu (paste the below command on terminal):
 sudo apt-get install freeglut3 freeglut3-dev

System will automatically install the necessary files which you need to run the OpenGL programs in Ubuntu.

3. For newer versions of Ubuntu (>= 11.10) you have to install another package because the linker does not link anymore(paste the below command on terminal):

sudo apt-get install binutils-gold

Note: If you are not administrator then, you need to ask for sudo permission.

Note:
 we are running any openGL code using simple command

4. Now create any c file(for example test.c) and compile :

gcc -lGL -lglut test.c -o test

5. Run the program :

Use the following command and create the file, as done with usual C/C++ program in Linux.

./test 
gcc -lGL -lglut test.c

than run using this command 
./a.out 

If you have any difficulty in installing opengl in linux ubuntu kindly comments in the commention section below. We will let you solve the all the issues related to installation of  opengl in linux ubuntu .

No comments:

Post a Comment