الخميس، 9 يونيو 2011

OpenGl installation (Windows and visual studio)

The OpenGL graphics library compromises three main parts. The core part (gl.h, gl.lib and gl.dll), the utility part (glu.h, glu.lib and glu.dll) and the toolkit part which enable OpenGL to interact with the windows (glut.h, glut.lib and glut.dll). Normally, the first two parts are already installed on your windows machine by default. You need only to install the third part as explained below.
Download OpenGl utility tool kit (GLUT) from the internet. You can easily find it by searching "download glut for windows in Google". Here is a link for a new version of the utility:
http://www.xmission.com/~nate/glut.html.
Usually, there are two options: downloading the compiled binary files and download the source files, both in zipped files. In principle, we need the compiled binary files. Hence, we download the zipped file for the compiled glut named something like:
  1.  Glut.h
  2.  Glut32.lib
  3.  Glut32.dll
glut-3.7.6-bin.zip. By decompressing the zipped file, the following three files should be extracted. Note
The above three files must be placed in their proper locations on your system. The glut32.dll should be put in the system32 folder under the window folder on your hard desk. The glut.h should be copied in the include folder of the visual c. To find this folder follow the path: C:\Program Files\Microsoft Visual Studio 9.0\VC\include. Of course, this will differ according to the version of visual studio, and your installation location. It’s preferred that you create a folder named GL in the include folder and copy glut.h there. The library files glut32.lib should be copied in the library folder (C:\Program Files\Microsoft Visual Studio 9.0\VC\lib). If you have not visual studio, the free Visual C++ express editions can go.
: since the glut is unmanaged code, you should download the binary file that goes with your hardware. If you have hardware other than the familiar inter 64 systems you can find a version of the library for the hardware platform you use to run your windows on the web site: http://www.opengl.org/resources/libraries/glut/glut_downloads.php#windows. Note
system.
 After the preparation of your system, you can write graphics programs in visual studio by creating Visual C++ console programs and just include the glut.h file in the beginning of any source file that calls OpenGL but after the inclusion of the standard io library. Just use #include <GL/glut.h>.
This first page should be sufficient but more details are given below. Best wishes… Dr. Hamed Hemeda
More detailed procedure for the installation (windows, Visual C++)


  1. 1. Download GLUT

  2. 2. Unzip the file.

    1. a. Put the file "glut32.dll" into the system path.
    2. b. This can be in the same directory as your executable file.
    3. c. On Windows XP or earlier, this can be in "C:\WINDOWS\system32"
    4. d. Or you can create a directory like "C:\DLLs", put the file in this directory and change your system path to include this new directory.
    5. i. Do this by opening Control Panel -> System, clicking on "Advanced System Settings", followed by "Environment Variables", and editing the "Path" variable.
  3. 3. Put the file "glut.h" into the standard Visual C++ include directory

    1. a. (For Visual Studio 2010, this should be: "C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\gl")
    2. b. (For Visual Studio 2008, this should be: "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl")
    3. c. (For Visual Studio 2005, this should be: "C:\Program Files\Microsoft Visual Studio.NET\Vc7\PlatformSDK\Include\gl")
    4. d. You've got the right directory if you see a copy of "gl.h"
  4. 4. Put the file "glut32.lib" into the standard Visual C++ library directory

    1. a. (For Visual Studio 2010, this should be: "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib")
    2. b. (For Visual Studio 2008, this should be: "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib")
    3. c. (For Visual Studio 2005, this should be: "C:\Program Files\Microsoft Visual Studio.NET\Vc7\PlatformSDK\lib")
    4. d. There should be lots of .lib files here, including "opengl32.lib" and "glu32.lib".
  5. 5. Make sure your Visual C++ project links in the GLUT/gl/glu libraries. This is located in:

    1. a. Menu: "Project -> (your-project-name) Properties"
    2. b. Tab: "Configuration Properties -> Linker -> Input"
    3. c. Under "Additional Dependancies", add "glut32.lib glu32.lib opengl32.lib"
  6. 6. #include < GL/glut.h > in your program.

    1. a.
    Note: This needs to come after you #include < stdio.h > and < stdlib.h >.
    Writing graphics programs
    . You should install the latest graphics driver for your graphics card to get the most of the graphics

    ليست هناك تعليقات:

    إرسال تعليق