Environment |
|
| OS: | Windows |
| Tools: | Visual C++, GLUT |
Before Starting |
| GLUT 3.7.6 should be downloaded here. glut-3.7.6-bin.zip includes everything to get started programming with GLUT. It includes glut32.dll, glut32.lib, glut.h which will be used in your compiling and running. |
| I am assuming that your PC is running windows XP, which should already have OpenGL support. However, GLUT is normally not installed. Next is a guide for installing GLUT and starting your project. |
|
| กก
กก |
|
Compiling Instructions |
|
| 1. | Click "Start" button and start Microsoft Visual Studio (C++) |
| 2. | Click the "New Project" button. |
| In the pop-up window, choose "Win32 Console Application". Type in the name of you program and the location of your program. eg. if the name of the program is "cg" and the location of your program is C:\users\($Your_Name)\temp, a directory named C:\users\($Your_Name)\temp\cg will be created. The workspace files will be placed in that directory and the source files will be created in a subdirectory cg. | |
| 3. | Click "Ok" buttun when done. |
| Click "Finish" button. A new project named "cg" has been created. | |
| 4. | Download example1.cpp (or simple.cpp) and place it together with the source files created by Visual C++. i.e. in the directory |
| C:\users\($Your_Name)\cg\cg | |
| 5. | Click menu item "Project" --> "Add Existing Items..." and add example1.cpp to the project |
| Note, you can also add new files to your project by clicking " Project" --> "Add New Items..." | |
| 6. | Delete the automatically generated cg.cpp from the project. |
| Since we are going to use example1.cpp, we don't need this auto-generated file anymore. Left-click assignmentX.cpp in the "Solution Explorer" and press "Delete" button on your keyboard. | |
| Note, this only removes assignmentX.cpp from the project, it does not physically delete the file from the project directory. | |
| 7. | Copy glut.h and glut32.lib to your source file directory, together with example1.cpp; |
| Copy glut32.lib to this directory either; | |
| 8. | Do NOT forget to include "stdafx.h"! |
| Add the line #include "stdafx.h" at the beginning of example1.cpp. Without this line your program won't compile. Now, your program should be good to go. | |
| 9. | Click the menu item "Project" --> "Properties...", choose "Linker" --> "Input", Type in Additional Dependencies: glut32.lib, glu32.lib; opengl32.lib. Click OK when done. |
| 9. | Click the menu item "Build" --> "Compile" (or F7) will compile a single source file in your project. |
| Click the menu item "Build" --> "cg" will build your program (compile and link all files) | |
| 10. | Copy glut32.dll to the directory generated as C:\users\($Your_Name)\temp\cg\Debug. |
| 11. | Click the menu item "Debug" --> "Start" will run your program in debugging mode. |
| 12. | To run your program in Release mode, Click the menu item "Debug" --> "Start without debugging" will run your program without debugging. BUT, you have to copy glut32.dll to the directory generated as C:\users\($Your_Name)\temp\cg\Release. |
| 13. | Refer to the online help for the debug commands. Take advantage of the debugging tools of Visual C++! |
|
|
|
| 14. | This
procedure is a simple but not a standard way to include GLUT in your
programming, where the glut.h glut32.lib and glut32.dll are saved in
your particular project cg so that you
don't need to play with the Visual Studio environment. It has been
tested in a computer in the computing lab 160. It can be used in your
personal computer as well. The drawback is: each time you start a new
project, you have to copy these files following the same
procedure.
However, if you are familiar with Visual Studio or you want to spend some time to play with it. Please read below Install GLUT 3.7 on your PC |
Notes: |
|
| 1> | This OpenGL Program Compiling Instruction page is particularly written for students enrolled in CG Fall 2006. |
| The official computing environment, please refer to the manual of your installed Visual Studio for how to include head files, libraries, and run time dll files, such as in the help of "VC++ Directories, Projects, Options Dialog Box" | |
| 2> | This page is tentative and is subject to change, please report to the instructor or the TA for the problems you met. |
| 3> | Online MSDN Library is a good place to visit when you have questions regarding C++ or openGL |