2
The OpenGL Extension Wrangler Library
3
Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
4
Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
5
Copyright (C) 2002, Lev Povalahev
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions are met:
11
* Redistributions of source code must retain the above copyright notice,
12
this list of conditions and the following disclaimer.
13
* Redistributions in binary form must reproduce the above copyright notice,
14
this list of conditions and the following disclaimer in the documentation
15
and/or other materials provided with the distribution.
16
* The name of the author may be used to endorse or promote products
17
derived from this software without specific prior written permission.
19
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
THE POSSIBILITY OF SUCH DAMAGE.
31
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html/4/loose.dtd">
32
<!-- <img src="new.png" height="12" alt="NEW!"> -->
36
GLEW: The OpenGL Extension Wrangler Library
38
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
39
<link href="glew.css" type="text/css" rel="stylesheet">
41
<body bgcolor="#fff0d0">
42
<table border="0" width="100%" cellpadding="12" cellspacing="8" style="height:100%">
44
<td bgcolor="#ffffff" align="left" valign="top" width="200">
45
<table border="0" width="100%" cellpadding="0" cellspacing="0" align="left">
48
<table border="0" width="100%" cellpadding="0" cellspacing="0" align="left">
49
<tr><td align="center"><i>Latest Release: <a href="https://sourceforge.net/project/showfiles.php?group_id=67586&package_id=67942&release_id=637800">1.5.1</a></i></td></tr>
50
<tr><td align="center"><br></td></tr>
51
<tr><td align="center"><img src="./glew.png" alt="GLEW Logo" width="97" height="75"></td></tr>
52
<tr><td align="center"><br></td></tr>
53
<tr><td align="center">
54
<table border="0" cellpadding="0" cellspacing="0" align="center">
55
<tr><td align="center"><a href="index.html">Download</a></td></tr>
56
<tr><td align="center"><a href="install.html">Installation</a></td></tr>
57
<tr><td align="center"><a href="basic.html">Basic Usage</a></td></tr>
58
<tr><td align="center"><b>Advanced Usage</b></td></tr>
59
<tr><td align="center"><a href="credits.html">Credits & Copyright</a></td></tr>
60
<tr><td align="center"><a href="log.html">Change Log</a></td></tr>
61
<tr><td align="center"><a href="http://sourceforge.net/projects/glew/">Project Page</a></td></tr>
62
<tr><td align="center"><a href="https://sourceforge.net/mail/?group_id=67586">Mailing Lists</a></td></tr>
63
<tr><td align="center"><a href="http://sourceforge.net/tracker/?group_id=67586">Bug Tracker</a></td></tr>
65
<tr><td align="center"><br></tr>
71
<table border="0" width="100%" cellpadding="5" cellspacing="0" align="left">
72
<tr><td align="center"><i>Last Update: 11-03-08</i></td></tr>
73
<tr><td align="center">
74
<a href="http://www.opengl.org"> <img src="./ogl_sm.jpg" width="68"
75
height="35" border="0" alt="OpenGL Logo"></a>
76
<a href="http://sourceforge.net"> <img
77
src="http://sourceforge.net/sflogo.php?group_id=67586&type=1"
78
width="88" height="31" border="0" alt="SourceForge Logo"></a>
81
<tr><td align="center"><a
82
href="http://sourceforge.net/donate/index.php?group_id=67586"><img
83
src="http://images.sourceforge.net/images/project-support.jpg"
84
width="88" height="32" border="0" alt="Support This Project"></a></td></tr>
91
<td bgcolor="#ffffff" align="left" valign="top">
93
<h1>The OpenGL Extension Wrangler Library</h1>
95
<h2>Automatic Code Generation</h2>
98
Starting from release 1.1.0, the source code and parts of the
99
documentation are automatically generated from the extension
100
specifications in a two-step process. In the first step,
101
specification files from the OpenGL registry are downloaded and
102
parsed. Skeleton descriptors are created for each extension. These
103
descriptors contain all necessary information for creating the source
104
code and documentation in a simple and compact format, including the
105
name of the extension, url link to the specification, tokens, function
106
declarations, typedefs and struct definitions. In the second step,
107
the header files as well as the library and glewinfo source are
108
generated from the descriptor files. The code generation scripts are
109
located in the <tt>auto</tt> subdirectory.
113
The code generation scripts require GNU make, wget, and perl. On
114
Windows, the simplest way to get access to these tools is to install
115
<a href="http://www.cygwin.com/">Cygwin</a>, but make sure that the
116
root directory is mounted in binary mode. The makefile in the
117
<tt>auto</tt> directory provides the following build targets:
121
<table border=0 cellpadding=0 cellspacing=0> <!-- bgcolor="#f0f0f0" -->
122
<tr><td align="right" valign="top" width="25%"><tt>make</tt></td>
123
<td> </td>
124
<td align=left>Create the source files from the descriptors. If the
125
descriptors do not exist, create them from the spec files. If the spec
126
files do not exist, download them from the OpenGL repository.</td></tr>
127
<tr><td align="right" valign="top"><tt>make clean</tt></td>
128
<td> </td>
129
<td align=left>Delete the source files.</td></tr>
130
<tr><td align="right" valign="top"><tt>make clobber</tt></td>
131
<td> </td>
132
<td align=left>Delete the source files and the descriptors.</td></tr>
133
<tr><td align="right" valign="top"><tt>make destroy</tt></td>
134
<td> </td>
135
<td align=left>Delete the source files, the descriptors, and the spec files.</td></tr>
136
<tr><td align="right" valign="top"><tt>make custom</tt></td>
137
<td> </td>
138
<td align=left>Create the source files for the extensions
139
listed in <tt>auto/custom.txt</tt>. See "Custom Code
140
Generation" below for more details.</td></tr>
144
<h3>Adding a New Extension</h3>
147
To add a new extension, create a descriptor file for the extension in
148
<tt>auto/core</tt> and rerun the code generation scripts by typing
149
<tt>make clean; make</tt> in the <tt>auto</tt> directory.
153
The format of the descriptor file is given below. Items in
154
brackets are optional.
158
<Extension Name><br>
159
[<URL of Specification File>]<br>
160
[<Token Name> <Token Value>]<br>
161
[<Token Name> <Token Value>]<br>
162
...<br>
163
[<Typedef>]<br>
164
[<Typedef>]<br>
165
...<br>
166
[<Function Signature>]<br>
167
[<Function Signature>]<br>
168
...<br>
169
<!-- [<Function Definition>]<br>
170
[<Function Definition>]<br>
171
...<br> -->
176
Note that <tt>Function Definitions</tt> are copied to the header files
177
without changes and have to be terminated with a semicolon. In
178
contrast, <tt>Tokens</tt>, <tt>Function signatures</tt>, and
179
<tt>Typedefs</tt> should not be terminated with a semicolon.
184
Take a look at one of the files in <tt>auto/core</tt> for an
185
example. Note that typedefs and function signatures should not be
186
terminated with a semicolon.
189
<h3>Custom Code Generation</h3>
191
Starting from GLEW 1.3.0, it is possible to control which extensions
192
to include in the libarary by specifying a list in
193
<tt>auto/custom.txt</tt>. This is useful when you do not need all the
194
extensions and would like to reduce the size of the source files.
195
Type <tt>make clean; make custom</tt> in the <tt>auto</tt> directory
196
to rerun the scripts with the custom list of extensions.
200
For example, the following is the list of extensions needed to get GLEW and the
201
utilities to compile.
205
WGL_ARB_extensions_string<br>
206
WGL_ARB_multisample<br>
207
WGL_ARB_pixel_format<br>
209
WGL_EXT_extensions_string<br>
210
WGL_ATI_pixel_format_float<br>
211
WGL_NV_float_buffer<br>
214
<h2>Multiple Rendering Contexts (GLEW MX)</h2>
216
<p>Starting with release 1.2.0, thread-safe support for multiple
217
rendering contexts, possibly with different capabilities, is
218
available. Since this is not required by most users, it is not added
219
to the binary releases to maintain compatibility between different
220
versions. To include multi-context support, you have to do the
223
<li>Compile and use GLEW with the <tt>GLEW_MX</tt> preprocessor token
225
<li>For each rendering context, create a <tt>GLEWContext</tt> object
226
that will be available as long as the rendering context exists.</li>
227
<li>Define a macro or function called <tt>glewGetContext()</tt> that
228
returns a pointer to the <tt>GLEWContext</tt> object associated with
229
the rendering context from which OpenGL/WGL/GLX calls are issued. This
230
dispatch mechanism is primitive, but generic.
231
<li>Make sure that you call <tt>glewInit()</tt> after creating the
232
<tt>GLEWContext</tt> object in each rendering context. Note, that the
233
<tt>GLEWContext</tt> pointer returned by <tt>glewGetContext()</tt> has
234
to reside in global or thread-local memory.
237
<p>Note that according to the <a
238
href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/ntopnglr_6yer.asp">MSDN
239
WGL documentation</a>, you have to initialize the entry points for
240
every rendering context that use pixel formats with different
241
capabilities For example, the pixel formats provided by the generic
242
software OpenGL implementation by Microsoft vs. the hardware
243
accelerated pixel formats have different capabilities. <b>GLEW by
244
default ignores this requirement, and does not define per-context
245
entry points (you can however do this using the steps described
246
above).</b> Assuming a global namespace for the entry points works in
247
most situations, because typically all hardware accelerated pixel
248
formats provide the same entry points and capabilities. This means
249
that unless you use the multi-context version of GLEW, you need to
250
call <tt>glewInit()</tt> only once in your program, or more precisely,
251
once per process.</p>
253
<h2>Separate Namespace</h2>
256
To avoid name clashes when linking with libraries that include the
257
same symbols, extension entry points are declared in a separate
258
namespace (release 1.1.0 and up). This is achieved by aliasing OpenGL
259
function names to their GLEW equivalents. For instance,
260
<tt>glFancyFunction</tt> is simply an alias to
261
<tt>glewFancyFunction</tt>. The separate namespace does not effect
262
token and function pointer definitions.
265
<h2>Known Issues</h2>
268
GLEW requires GLX 1.2 for compatibility with GLUT.