Archive

Posts Tagged ‘opengl installation’

How to install GLUT on DevC++

May 15, 2012 9 comments

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: 

  1. Dev C++ installed, latest version.
  2. Knowledge of C++ with basic idea of event driven programming and working in windows.h

Installation:

    1. Download this small zip file from here, it contains GLUT , libraries and header files
      http://www.mediafire.com/?34171u995goq9ci
    2.  Extract the zip file and place it in any desired folder
    3. Open a file named “glut-7.6-3.DevPak” and let it to its work.
    4. As soon as “glut-7.6-3.DevPak” has finished its work, do the following steps:
      • File->New->Project
      • Click on Multimedia and select GLUT

      OR

      • File->New->Project
      • Click “Empty project”, Give it a desired name and save it in any folder .
    5. (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.
    6. (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
    7. 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
    8. Now goto menu-bar (That “File, edit and help” toolbar ) and click on Project->Project properties. Or you can use keyboard shortcut “Alt + P”
    9. Click on “Parameters” then click on “Add Library or Object” button.
    10. Point your browser to “lib” folder in those extracted folder.
    11. Now add these lines in starting of your Linker textbox

      -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32

      And -DGLUT_STATIC in Compiler textbox

    12. Now you can finally press F9 and see a small rectangle in window.
    13. (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. 🙂

Categories: OpenGL Tags: , ,