How to install GLUT on DevC++
Ever imagined how the graphics in games such as Counter Strike or mobile games in Android and iPhone are made? Well I’ld like you guys to google “Which graphics library is used in android games” I guess the only answer you will get is OpenGL.
One of the very basic way of practicing computer graphic practically is by using OpenGL library. Yes its the same library which is used by many world famous games such as Counter Strike and almost every Android and iPhone game.
OpenGL Official : http://www.opengl.org
OpenGL Wiki : http://en.wikipedia.org/wiki/OpenGL
Now if you want to work with OpenGL , you should have basic working knowledge of “GUI Programming” a.k.a “Event Driven Programming” like how does it works, how to program GUI programs etc etc… Especially working with windows.h if you are interested in programming in C/C++.
Thus to reduce our work in GUI Programming or i should say windows.h we will make use of OpenGL Tool Kit a.k.a GLUT ( http://en.wikipedia.org/wiki/OpenGL_Utility_Toolkit ) .
If you want to know more about OpenGL, GLUT and power of OpenGL, you should search on google, use the links provided above and read more about the usage of it Okay now
Back to the topic, How to install Glut on Dev C++
Pre requisites:
- Dev C++ installed, latest version.
- Knowledge of C++ with basic idea of event driven programming and working in windows.h
Installation:
- Download this small zip file from here, it contains GLUT , libraries and header files
http://www.mediafire.com/?34171u995goq9ci - Extract the zip file and place it in any desired folder
- Open a file named “glut-7.6-3.DevPak” and let it to its work.
- As soon as “glut-7.6-3.DevPak” has finished its work, do the following steps:
OR
- (Skip this if you’ve chosen glut project in step no. 4 )
Now right click on your project and click “New File”.
You will see an “untitled” file. - (Skip this if you’ve chosen glut project in step no. 4 )Now paste the following code in that untitled file
http://www.mediafire.com/?dfbanmca5nsxudp - Now press F9 i.e. Compile and Run. you will see many linker errors dont worry, its just because we didnt link our project with the libraries of OpenGL and GLUT
- Now goto menu-bar (That “File, edit and help” toolbar ) and click on Project->Project properties. Or you can use keyboard shortcut “Alt + P”
- Click on “Parameters” then click on “Add Library or Object” button.
- Point your browser to “lib” folder in those extracted folder.
- Now add these lines in starting of your Linker textbox
-lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32
- Now you can finally press F9 and see a small rectangle in window.
- (Optional) Replace the code of your file with this to see some more effects of OpenGL
http://www.mediafire.com/?5jiu96u1446yxci
Reference: http://techtoggle.com/2009/01/some-cool-opengl-programs-for-beginners-c
Please post your reviews, errors and support me by sharing this post!!!
You can comment your doubts or errors and I’ll try my best to solve them. 🙂