For this first OpenGL tutorial, we are going to see how to install OpenGL on GNU/Linux and Windows operating system.
We need the OpenGL files, but also those from the GLU and GLUT for GNU/Linux and freeGLUT for Windows.
The last ones, GLU and GLUT are libraries that add functionnalities from the basic OpenGL.
If you do not have the glut.h file in your /usr/include/GL/ directory, let's install it with the following command on your favorite shell:
sudo yum install freeglut-devel
1) With Ubuntu Software Center
Don't forget to enable:
Edit > Software Sources... > Updates > Important security updates (precise-security).
Edit > Software Sources... > Updates > Recommanded updates (precise-updates).
Search for freeglut3 and freeglut3-dev.
Install them.
2) With apt-get
With apt-get and the following command line:
sudo apt-get install freeglut3
It will install the following header files (*.h) inside /usr/include/GL:
glext.h gl.h gl_mangle.h glu.h glu_mangle.h glxext.h glx.h glx_mangle.h internal/
Then with:
sudo apt-get install freeglut3-dev
It will install specific header files to develop software with OpenGL in the same directory as before (/usr/include/GL):
freeglut_ext.h freeglut.h freeglut_std.h glut.h
Header files are now ready to be used.
On the right, two panels: one for the library names (-l) and the other for the library paths (-L).
Click Apply then OK.
Your Eclipse IDE is now ready to use OpenGL on Linux.
I choose Eclipse because I like it.
You are free to use another IDE of course.
To begin, we have to download the freeGLUT for Windows:
Click on Download freeglut 2.8.0-1 for MinGW.
Yes, you have to use MinGW (a tutorial is on my website, if you don't know what is it).
Once downloaded, extract the directory into another one, I choose: C:\soft\library\freeglut.
On the right, two panels: one for the library names (-l) and the other for the library paths (-L).
On the Library search path (-L), click on the tiny plus icon and add: C:\soft\library\freeglut\lib
Click Apply then OK.
You have now to right click on your project name once again then:
> Properties > C/C++ General > Paths and Symbols > Includes > GNU C++.
On the right click Add... then add: c:/soft/library/freeglut/include.
On the Configurations dropdown menu, check if Debug or Release is selected (it will be important when you will try to compile).
Click Apply then OK.
Your Eclipse IDE is now ready to use OpenGL on Windows.
You can now use OpenGL with ease and voluptuousness.
Well done.
Comments
Vladimir Romanov (not verified)
Monday, November 19, 2012 - 12:16am
Permalink
What are the preconditions to
What are the preconditions to follow this setup? I have Eclipse Juno with C++ installed, but anyway I get errors like "\workspace\demoCPP\Debug/../src/demoCPP.cpp:21: undefined reference to `glClear@4'" for each openGL command.
Mi-K
Monday, November 19, 2012 - 6:54pm
Permalink
Hello Vladimir ,
Hello Vladimir
Anonymous (not verified)
Thursday, August 18, 2016 - 8:06am
Permalink
thank you
thank you
Add new comment