4
To use the shared library version of GLEW, you need to copy the
5
headers and libraries into their destination directories. On Windows
6
this typically boils down to copying:
9
<table border="0" cellpadding="0" cellspacing="0" align="center"> <!-- bgcolor="#f0f0f0" -->
10
<tr><td align="left"><tt>bin/glew32.dll</tt></td><td> to </td>
11
<td align="left"><tt>%SystemRoot%/system32</tt></td></tr>
12
<tr><td align="left"><tt>lib/glew32.lib</tt></td><td> to </td>
13
<td align="left"><tt>{VC Root}/Lib</tt></td></tr>
14
<tr><td align="left"><tt>include/GL/glew.h</tt></td><td> to </td>
15
<td align="left"><tt>{VC Root}/Include/GL</tt></td></tr>
16
<tr><td align="left"><tt>include/GL/wglew.h</tt></td><td> to </td>
17
<td align="left"><tt>{VC Root}/Include/GL</tt></td></tr>
23
where <tt>{VC Root}</tt> is the Visual C++ root directory, typically
24
<tt>C:/Program Files/Microsoft Visual Studio/VC98</tt> for Visual
25
Studio 6.0 or <tt>C:/Program Files/Microsoft Visual
26
Studio .NET 2003/Vc7/PlatformSDK</tt> for Visual Studio .NET.
30
On Unix, typing <tt>make install</tt> will attempt to install GLEW
31
into <tt>/usr/include/GL</tt> and <tt>/usr/lib</tt>. You can
32
customize the installation target via the <tt>GLEW_DEST</tt>
33
environment variable if you do not have write access to these
37
<h2>Building Your Project with GLEW</h2>
39
There are two ways to build your project with GLEW.
41
<h3>Including the source files / project file</h3>
43
The simpler but less flexible way is to include <tt>glew.h</tt> and
44
<tt>glew.c</tt> into your project. On Windows, you also need to
45
define the <tt>GLEW_STATIC</tt> preprocessor token when building a
46
static library or executable, and the <tt>GLEW_BUILD</tt> preprocessor
47
token when building a dll. You also need to replace
48
<tt><GL/gl.h></tt> and <tt><GL/glu.h></tt> with
49
<tt><glew.h></tt> in your code and set the appropriate include
50
flag (<tt>-I</tt>) to tell the compiler where to look for it. For
54
#include <glew.h><br>
55
#include <GL/glut.h><br>
56
<gl, glu, and glut functionality is available here><br>
59
Depending on where you put <tt>glew.h</tt> you may also need to change
60
the include directives in <tt>glew.c</tt>. Note that if you are using
61
GLEW together with GLUT, you have to include <tt>glew.h</tt> first.
62
In addition, <tt>glew.h</tt> includes <tt>glu.h</tt>, so you do not
63
need to include it separately.
66
On Windows, you also have the option of adding the supplied project
67
file <tt>glew_static.dsp</tt> to your workspace (solution) and compile
68
it together with your other projects. In this case you also need to
69
change the <tt>GLEW_BUILD</tt> preprocessor constant to
70
<tt>GLEW_STATIC</tt> when building a static library or executable,
71
otherwise you get build errors.
74
<b>Note that GLEW does not use the C
75
runtime library, so it does not matter which version (single-threaded,
76
multi-threaded or multi-threaded DLL) it is linked with (without
77
debugging information). It is, however, always a good idea to compile all
78
your projects including GLEW with the same C runtime settings.</b>
81
<h3>Using GLEW as a shared library</h3>
84
Alternatively, you can use the provided project files / makefile to
85
build a separate shared library you can link your projects with later.
86
In this case the best practice is to install <tt>glew.h</tt>,
87
<tt>glew32.lib</tt>, and <tt>glew32.dll</tt> / <tt>libGLEW.so</tt> to
88
where the OpenGL equivalents <tt>gl.h</tt>, <tt>opengl32.lib</tt>, and
89
<tt>opengl32.dll</tt> / <tt>libGL.so</tt> are located. Note that you
90
need administrative privileges to do this. If you do not have
91
administrator access and your system administrator will not do it for
92
you, you can install GLEW into your own lib and include subdirectories
93
and tell the compiler where to find it. Then you can just replace
94
<tt><GL/gl.h></tt> with <tt><GL/glew.h></tt> in your
99
#include <GL/glew.h><br>
100
#include <GL/glut.h><br>
101
<gl, glu, and glut functionality is available here><br>
109
#include <GL/glew.h><br>
110
<gl and glu functionality is available here><br>
114
Remember to link your project with <tt>glew32.lib</tt>,
115
<tt>glu32.lib</tt>, and <tt>opengl32.lib</tt> on Windows and
116
<tt>libGLEW.so</tt>, <tt>libGLU.so</tt>, and <tt>libGL.so</tt> on
117
Unix (<tt>-lGLEW -lGLU -lGL</tt>).
121
It is important to keep in mind that <tt>glew.h</tt> includes neither
122
<tt>windows.h</tt> nor <tt>gl.h</tt>. Also, GLEW will warn you by
123
issuing a preprocessor error in case you have included <tt>gl.h</tt>,
124
<tt>glext.h</tt>, or <tt>glATI.h</tt> before <tt>glew.h</tt>.