Skip to content


Dev-C++ & OpenGL

This tutorial is for those who want to get started with OpenGL using Dev-C++.OpenGL is open graphics library created by silicon graphics.It is the specification of some functions that let you draw some shape on the screen.This article makes use of library called GLUT,that works with OpenGL to create and maintain a window.In order create graphics using OpenGL you will need glut.h and glut32.dll. These files are available for free on the web or [Here] You can download most of what you need from there,if you unable to find it out then don’t panic.There is devpak available for Dev-C++ for openGL.All you have to do is add the devpack in dev-cpp package manager.If you’re using any other compiler then you can skip this and direct yourself [Here] .

So you’ve two choices either download the files manually (glut.h& glut32.dll) or use the devpak for Dev-C++ & Codeblocks. Let’s start with devpak method.

Devpak Installation
If you’re opting to install the devpak instead of dll files manually,you have to download the opengl devpak. You can download Nigel’s opengl devpak from [Here]. From the list on the page Download glut.3.7.6+.DevPak to a local folder.In Dev C++,open the package manager: Tools->Package Manager.Here,you can see the pre-installed packages that came with your distribution of dev-cpp.To Install the glut package,click on Package->Install Package.Browse to the location where you’ve downloaded the glut devpak.Once you done with adding,it will appear in the package manager list.Now you can safely exit package manager.Now you’re ready to write program on Opengl with devcpp.You don’t need to follow the compiler configuration explained below if you’ve downloaded the opengl devpak.

Compiler configuration
If you’ve downloaded the glut.h & glut32.dll then you’ve to copy those files into the devcpp’s ” /lib” folder. Now you’ve to setup the IDE’s configuration, so that you can use the opengl library with it. Let’s start by creating new “Project”.Select Empty Project type from the basic tab window,make sure C++ project is selected.Create the new project in the folder with the source file.Add the .cpp file to the project by Project->add to project.Select the .cpp file

Now we have to add some parameters in linker options.In order to do that go to Project->Project options.In the “Parameters” tab window add the following line in the Linker pane:

-lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32

Now click “Ok”,when you done with it.

We are done with the installtion & compiler configuration of opengl devpack into dev-cpp.Ig you’ve done the above steps carefully,you will able to write any opengl code with dev-cpp.

Help & Support
OpenGL is largely documented in web & print media due to its ease of use & effectiveness.Almost every famous compiler on the web has some documentation for the OpenGL.It is very difficult to point each & every resource,i’m pointing out to some of the effective ones.

OpenGL home page
SGI opengl page
Google groups comp.graphics.api.opengl
IRC Channel : #OpenGL
OpenGL official FAQ

OpenGL Basics FAQ
OpenGL Game Developers FAQ
Win32 OpenGL programming
Nehe OpenGL Tutorial
Delphi Code

If you are looking for more information about opengl try the resources mentioned above.If you have any suggestions or questions please post them here.


12 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Kapil Saini says

    Thanks

  2. Caster Troy says

    thank you so much

  3. Krishna says

    Thankyou so much. I have been trying to get opengl to work with dev c++ for 2 days and visited a lot of websites for help and i finally nailed it by following your procedure. :)

  4. Me says

    Thank you!!

  5. ravikant says

    thanx a lot…. i have been looking for it for long time.. thanx once again.

  6. rushikesh says

    thanks

  7. Ahmed says

    thank u
    that was helpful to get started

  8. Karthik says

    Nice one! definitely saved a lot of time….

  9. S/\I|\/| S/\R|/\|/\R says

    I m a student of BS(CS) so i get advice with guys for the best library for game programming which is easier to use. Allegro or OpenGl. so suggest me which is best . . . my project is to develope a game. . .

  10. Chirag Varde says

    thnx a lot..

  11. epicbeast9022 says

    works very nicely. i hate visual studio and i needed this REALLY BAD

Continuing the Discussion

  1. Why is everything so incompatible...? linked to this post on July 26, 2010

    [...] the library names should be something like libgl.a, libglu.a, libglut.a. Anyway found this page: Dev-C++ & OpenGL | Onecore First one if you search after: Dev-C++ OpenGL My Code Blog – My Github – Ascension Project [...]



Some HTML is OK

or, reply to this post via trackback.