To use OpenGL, you link your executable to the special OpenGL libraries and include some special OpenGL headers. Typically you do the 'linking' by adding 536these additional libraries to your project: opengl32.lib and glu32.lib . (You can see Appendix C for how to add libraries to a Visual Studio project.) And you do the 'including' by putting lines like the following into any files that mention the OpenGL functions. (In particular, the Pop framework has these lines in its graphicsopengl.h header.)
#include "gl\gl.h" #include "gl\glu.h"
Once your code is linked up, you can make OpenGL function calls in your code. The OpenGL functions begin with one of the prefixes gl or glu . We usually put the scope resolution operator ' :: ' in front of these functions names as a reminder that these are global functions, rather than being members of any class. In addition, Windows has some special functions designed for linking to OpenGL. Some, but not all, of these functions start with the prefix wgl .
The functions our code uses are found in the following libraries:
And of course our code will, as usual, use special functions defined in the MFC libraries and in the basic Win32 libraries. Figure 26.1 shows how Pop and the various libraries depend upon each other.
Figure 26.1. Component diagram for Pop's use of OpenGL libraries