2
Copyright (C) 2002-2006, Milan Ikits <milan ikits[]ieee org>
3
Copyright (C) 2002-2006, Marcelo E. Magallon <mmagallo[]debian org>
4
This documentation may not be modified or redistributed in any
5
form, except by the copyright holder.
7
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html/4/loose.dtd">
8
<!-- <img src="new.png" height="12" alt="NEW!"> -->
12
GLEW: The OpenGL Extension Wrangler Library
14
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
15
<link href="glew.css" type="text/css" rel="stylesheet">
17
<body bgcolor="#fff0d0">
18
<table border="0" width="100%" cellpadding="12" cellspacing="8" style="height:100%">
20
<td bgcolor="#ffffff" align="left" valign="top" width="200">
21
<table border="0" width="100%" cellpadding="0" cellspacing="0" align="left">
24
<table border="0" width="100%" cellpadding="0" cellspacing="0" align="left">
25
<tr><td align="center"><i>Latest Release: <a href="https://sourceforge.net/project/showfiles.php?group_id=67586&package_id=67942&release_id=398455">1.3.4</a></i></td></tr>
26
<tr><td align="center"><br></td></tr>
27
<tr><td align="center"><img src="./glew.png" alt="GLEW Logo" width="97" height="75"></td></tr>
28
<tr><td align="center"><br></td></tr>
29
<tr><td align="center">
30
<table border="0" cellpadding="0" cellspacing="0" align="center">
31
<tr><td align="center"><a href="index.html">Download</a></td></tr>
32
<tr><td align="center"><a href="install.html">Installation</a></td></tr>
33
<tr><td align="center"><a href="basic.html">Basic Usage</a></td></tr>
34
<tr><td align="center"><b>Advanced Usage</b></td></tr>
35
<tr><td align="center"><a href="credits.html">Credits & Copyright</a></td></tr>
36
<tr><td align="center"><a href="log.html">Change Log</a></td></tr>
37
<tr><td align="center"><a href="http://sourceforge.net/projects/glew/">Project Page</a></td></tr>
38
<tr><td align="center"><a href="https://sourceforge.net/mail/?group_id=67586">Mailing Lists</a></td></tr>
39
<tr><td align="center"><a href="http://sourceforge.net/tracker/?group_id=67586">Bug Tracker</a></td></tr>
41
<tr><td align="center"><br></tr>
47
<table border="0" width="100%" cellpadding="5" cellspacing="0" align="left">
48
<tr><td align="center"><i>Last Update: 03-04-06</i></td></tr>
49
<tr><td align="center">
50
<a href="http://www.opengl.org"> <img src="./ogl_sm.jpg" width="68"
51
height="35" border="0" alt="OpenGL Logo"></a>
52
<a href="http://sourceforge.net"> <img
53
src="http://sourceforge.net/sflogo.php?group_id=67586&type=1"
54
width="88" height="31" border="0" alt="SourceForge Logo"></a>
63
<td bgcolor="#ffffff" align="left" valign="top">
65
<h1>The OpenGL Extension Wrangler Library</h1>
67
<h2>Automatic Code Generation</h2>
70
Starting from release 1.1.0, the source code and parts of the
71
documentation are automatically generated from the extension
72
specifications in a two-step process. In the first step,
73
specification files from the OpenGL registry are downloaded and
74
parsed. Skeleton descriptors are created for each extension. These
75
descriptors contain all necessary information for creating the source
76
code and documentation in a simple and compact format, including the
77
name of the extension, url link to the specification, tokens, function
78
declarations, typedefs and struct definitions. In the second step,
79
the header files as well as the library and glewinfo source are
80
generated from the descriptor files. The code generation scripts are
81
located in the <tt>auto</tt> subdirectory.
85
The code generation scripts require GNU make, wget, and perl. On
86
Windows, the simplest way to get access to these tools is to install
87
<a href="http://www.cygwin.com/">Cygwin</a>, but make sure that the
88
root directory is mounted in binary mode. The makefile in the
89
<tt>auto</tt> directory provides the following build targets:
93
<table border=0 cellpadding=0 cellspacing=0> <!-- bgcolor="#f0f0f0" -->
94
<tr><td align="right" valign="top" width="25%"><tt>make</tt></td>
95
<td> </td>
96
<td align=left>Create the source files from the descriptors. If the
97
descriptors do not exist, create them from the spec files. If the spec
98
files do not exist, download them from the OpenGL repository.</td></tr>
99
<tr><td align="right" valign="top"><tt>make clean</tt></td>
100
<td> </td>
101
<td align=left>Delete the source files.</td></tr>
102
<tr><td align="right" valign="top"><tt>make clobber</tt></td>
103
<td> </td>
104
<td align=left>Delete the source files and the descriptors.</td></tr>
105
<tr><td align="right" valign="top"><tt>make destroy</tt></td>
106
<td> </td>
107
<td align=left>Delete the source files, the descriptors, and the spec files.</td></tr>
108
<tr><td align="right" valign="top"><tt>make custom</tt></td>
109
<td> </td>
110
<td align=left>Create the source files for the extensions
111
listed in <tt>auto/custom.txt</tt>. See "Custom Code
112
Generation" below for more details.</td></tr>
116
<h3>Adding a New Extension</h3>
119
To add a new extension, create a descriptor file for the extension in
120
<tt>auto/core</tt> and rerun the code generation scripts by typing
121
<tt>make clean; make</tt> in the <tt>auto</tt> directory.
125
The format of the descriptor file is given below. Items in
126
brackets are optional.
130
<Extension Name><br>
131
[<URL of Specification File>]<br>
132
[<Token Name> <Token Value>]<br>
133
[<Token Name> <Token Value>]<br>
134
...<br>
135
[<Typedef>]<br>
136
[<Typedef>]<br>
137
...<br>
138
[<Function Signature>]<br>
139
[<Function Signature>]<br>
140
...<br>
141
<!-- [<Function Definition>]<br>
142
[<Function Definition>]<br>
143
...<br> -->
148
Note that <tt>Function Definitions</tt> are copied to the header files
149
without changes and have to be terminated with a semicolon. In
150
contrast, <tt>Tokens</tt>, <tt>Function signatures</tt>, and
151
<tt>Typedefs</tt> should not be terminated with a semicolon.
156
Take a look at one of the files in <tt>auto/core</tt> for an
157
example. Note that typedefs and function signatures should not be
158
terminated with a semicolon.
161
<h3>Custom Code Generation</h3>
163
Starting from GLEW 1.3.0, it is possible to control which extensions
164
to include in the libarary by specifying a list in
165
<tt>auto/custom.txt</tt>. This is useful when you do not need all the
166
extensions and would like to reduce the size of the source files.
167
Type <tt>make clean; make custom</tt> in the <tt>auto</tt> directory
168
to rerun the scripts with the custom list of extensions.
172
For example, the following is the list of extensions needed to get GLEW and the
173
utilities to compile.
177
WGL_ARB_extensions_string<br>
178
WGL_ARB_multisample<br>
179
WGL_ARB_pixel_format<br>
181
WGL_EXT_extensions_string<br>
182
WGL_ATI_pixel_format_float<br>
183
WGL_NV_float_buffer<br>
186
<h2>Multiple Rendering Contexts (GLEW MX)</h2>
188
<p>Starting with release 1.2.0, thread-safe support for multiple
189
rendering contexts, possibly with different capabilities, is
190
available. Since this is not required by most users, it is not added
191
to the binary releases to maintain compatibility between different
192
versions. To include multi-context support, you have to do the
195
<li>Compile and use GLEW with the <tt>GLEW_MX</tt> preprocessor token
197
<li>For each rendering context, create a <tt>GLEWContext</tt> object
198
that will be available as long as the rendering context exists.</li>
199
<li>Define a macro or function called <tt>glewGetContext()</tt> that
200
returns a pointer to the <tt>GLEWContext</tt> object associated with
201
the rendering context from which OpenGL/WGL/GLX calls are issued. This
202
dispatch mechanism is primitive, but generic.
203
<li>Make sure that you call <tt>glewInit()</tt> after creating the
204
<tt>GLEWContext</tt> object in each rendering context. Note, that the
205
<tt>GLEWContext</tt> pointer returned by <tt>glewGetContext()</tt> has
206
to reside in global or thread-local memory.
209
<p>Note that according to the <a
210
href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/ntopnglr_6yer.asp">MSDN
211
WGL documentation</a>, you have to initialize the entry points for
212
every rendering context that use pixel formats with different
213
capabilities For example, the pixel formats provided by the generic
214
software OpenGL implementation by Microsoft vs. the hardware
215
accelerated pixel formats have different capabilities. <b>GLEW by
216
default ignores this requirement, and does not define per-context
217
entry points (you can however do this using the steps described
218
above).</b> Assuming a global namespace for the entry points works in
219
most situations, because typically all hardware accelerated pixel
220
formats provide the same entry points and capabilities. This means
221
that unless you use the multi-context version of GLEW, you need to
222
call <tt>glewInit()</tt> only once in your program, or more precisely,
223
once per process.</p>
225
<h2>Separate Namespace</h2>
228
To avoid name clashes when linking with libraries that include the
229
same symbols, extension entry points are declared in a separate
230
namespace (release 1.1.0 and up). This is achieved by aliasing OpenGL
231
function names to their GLEW equivalents. For instance,
232
<tt>glFancyFunction</tt> is simply an alias to
233
<tt>glewFancyFunction</tt>. The separate namespace does not effect
234
token and function pointer definitions.
237
<h2>Known Issues</h2>
240
GLEW requires GLX 1.2 for compatibility with GLUT.