Compilation and Installation Instructions for OpenGL

A. Your account on the Windows PCs in the Software Engineering Lab:
When you first log in, you may encounter several pop-up dialog windows giving error/warning messages. Ignore them by pressing "OK" or "Yes". You should be able to log in successfully. After the first time, you should be able to log in normally. Once you log on, look at the H: drive for your home directory. Note that you have a write permission only to your home directory .

B. Compilation Steps for Visual C++ (VC++) 2008 (similarly for other versions):

  1. Start VC++ from the start menu.
  2. File -> New a project with template Win32 Console Application (note: not Win32 Project), give a project name. In the next pop-up window, click Application Settings. In the yet next pop-up window, choose Empty project (so that the two items chosen are Console application and Empty project), and click Finish. A new folder with the project name is created (if you want to use an existing folder which contains all source (.c or .cpp) files, in the first pop-up window give this folder name as the "Name" and its parent folder location as the "Location").
  3. If you want to open an existing project, instead of New use Open -> Project/Solution.
  4. Move all source (.c or .cpp) files, header (.h) files, and input data files to the project folder (either the new folder created in Step 2 or the existing folder mentioned at the end of Step 2).
    In the left sub-window of VC++, right click Source Files and select Add -> Existing Item to include the source (.c or .cpp) files, one by one, into the project as source files. Similarly include the .h files (if any) as Header Files. (For shader files *.glsl, you can include them as Resource Files in the same way.)
  5. Sometimes it is necessary to declare the dependencies for the libraries used:
    a. Click on Project -> [project name] Properties.
    b. In the left window, click Configuration Properties to expand it. On the very top left, the Configuration drop-down, select All Configurations.
    c. Below Configuration Properties, select Linker -> Input.
    d. In the right window, click Additional Dependencies to activate this field. Type in
    "glew32.lib glut32.lib opengl32.lib glu32.lib". Then click OK.

    Typically these *.lib files can be automatically found except for "glew32.lib". Thus, for OpenGL projects that use GLEW (such as those involving GLSL) you only need to specify "glew32.lib" here; for other OpenGL projects you don't need to specify anything (except when the needed *.lib files cannot be automatically found during linking).

  6. To compile, click on Build -> Build [project name] (or Rebuild [project name]).
    To run, click on Debug -> Start Without Debugging (or Ctrl+F5).

Note: All VC++ programs using OpenGL functions must start with #include <windows.h> followed by #include <GL/glut.h> in the source code. If you use GLEW functions, put #include <GL/glew.h> before #include <GL/glut.h>. Also, if you need to include "stdlib.h", put #include <stdlib.h> before #include <GL/glut.h>. In summary, put them in this order: #include <windows.h> then #include <stdlib.h> then #include <GL/glew.h> then #include <GL/glut.h>.

C. Installation on your own PC by yourself:
You need to have the VC++ software installed (there is a free download version, VC++ 2008 Express Edition, available at this site ). You may also need to install the Microsoft Windows SDK package (e.g., Windows SDK for Windows Server 2008 and .NET Framework 3.5, freely available at this site ). You need to get the GLUT package (available from the course web site "http://cis.poly.edu/cs653/glut-3.7.6-bin.zip" ) and the GLEW package (available from the course web site "http://cis.poly.edu/cs653/glew-1.5.1-win32.zip" ). After unzipping the GLUT and GLEW packages, put the following files to the specified folders as below:

1. glut.h, glew.h, wglew.h: to the "include/gl" folder of either VC++ or SDK (e.g., "C:\Program Files\Microsoft SDKs\Windows\v6.1\Include\gl", or "C:\Program Files\Microsoft Visual Studio 8\VC\include\gl\"), where the OpenGL header files "gl.h" and "glu.h" should already be there.

2. glut32.lib, glew32.lib: to the "Lib" folder of either VC++ or SDK (e.g., "C:\Program Files\Microsoft SDKs\Windows\v6.1\Lib" or "C:\Program Files\Microsoft Visual Studio 8\VC\lib"), where the OpenGL library files "opengl32.lib" and "glu32.lib" should already be there.

3. glut32.dll, glew32.dll: to the systems folder (e.g., "C:\Windows\System32" for a 32-bit OS, or "C:\Windows\SysWOW64" for a 64-bit OS), where the OpenGL .DLL files "opengl32.dll" and "glu32.dll" should already be there.