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"><b>Basic Usage</b></td></tr>
58
<tr><td align="center"><a href="advanced.html">Advanced Usage</a></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>Initializing GLEW</h2>
97
First you need to create a valid OpenGL rendering context and call
98
<tt>glewInit()</tt> to initialize the extension entry points. If
99
<tt>glewInit()</tt> returns <tt>GLEW_OK</tt>, the initialization
100
succeeded and you can use the available extensions as well as core
101
OpenGL functionality. For example:
105
#include <GL/glew.h><br>
106
#include <GL/glut.h><br>
108
glutInit(&argc, argv);<br>
109
glutCreateWindow("GLEW Test");<br>
110
GLenum err = glewInit();<br>
111
if (GLEW_OK != err)<br>
113
/* Problem: glewInit failed, something is seriously wrong. */<br>
114
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));<br>
117
fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));<br>
120
<h2>Checking for Extensions</h2>
123
Starting from GLEW 1.1.0, you can find out if a particular extension
124
is available on your platform by querying globally defined variables
125
of the form <tt>GLEW_{extension_name}</tt>:
129
if (GLEW_ARB_vertex_program)<br>
131
/* It is safe to use the ARB_vertex_program extension here. */<br>
132
glGenProgramsARB(...);<br>
137
<b>In GLEW 1.0.x, a global structure was used for this task. To ensure
138
binary compatibility between releases, the struct was replaced with a
139
set of variables.</b>
143
You can also check for core OpenGL functionality. For example, to
144
see if OpenGL 1.3 is supported, do the following:
148
if (GLEW_VERSION_1_3)<br>
150
/* Yay! OpenGL 1.3 is supported! */<br>
155
In general, you can check if <tt>GLEW_{extension_name}</tt> or
156
<tt>GLEW_VERSION_{version}</tt> is true or false.
160
It is also possible to perform extension checks from string
161
input. Starting from the 1.3.0 release, use <tt>glewIsSupported</tt>
162
to check if the required core or extension functionality is
167
if (glewIsSupported("GL_VERSION_1_4 GL_ARB_point_sprite"))<br>
169
/* Great, we have OpenGL 1.4 + point sprites. */<br>
174
For extensions only, <tt>glewGetExtension</tt> provides a slower alternative
175
(GLEW 1.0.x-1.2.x). <b>Note that in the 1.3.0 release </b>
176
<tt>glewGetExtension</tt> <b>was replaced with </b>
177
<tt>glewIsSupported</tt>.
181
if (glewGetExtension("GL_ARB_fragment_program"))<br>
183
/* Looks like ARB_fragment_program is supported. */<br>
187
<h2>Experimental Drivers</h2>
190
GLEW obtains information on the supported extensions from the graphics
191
driver. Experimental or pre-release drivers, however, might not
192
report every available extension through the standard mechanism, in
193
which case GLEW will report it unsupported. To circumvent this
194
situation, the <tt>glewExperimental</tt> global switch can be turned
195
on by setting it to <tt>GL_TRUE</tt> before calling
196
<tt>glewInit()</tt>, which ensures that all extensions with valid
197
entry points will be exposed.
200
<h2>Platform Specific Extensions</h2>
203
Platform specific extensions are separated into two header files:
204
<tt>wglew.h</tt> and <tt>glxew.h</tt>, which define the available
205
<tt>WGL</tt> and <tt>GLX</tt> extensions. To determine if a certain
206
extension is supported, query <tt>WGLEW_{extension name}</tt> or
207
<tt>GLXEW_{extension_name}</tt>. For example:
211
#include <GL/wglew.h><br>
213
if (WGLEW_ARB_pbuffer)<br>
215
/* OK, we can use pbuffers. */<br>
219
/* Sorry, pbuffers will not work on this platform. */<br>
224
Alternatively, use <tt>wglewIsSupported</tt> or
225
<tt>glxewIsSupported</tt> to check for extensions from a string:
229
if (wglewIsSupported("WGL_ARB_pbuffer"))<br>
231
/* OK, we can use pbuffers. */<br>
238
GLEW provides two command-line utilities: one for creating a list of
239
available extensions and visuals; and another for verifying extension
243
<h3>visualinfo: extensions and visuals</h3>
246
<tt>visualinfo</tt> is an extended version of <tt>glxinfo</tt>. The
247
Windows version creates a file called <tt>visualinfo.txt</tt>, which
248
contains a list of available OpenGL, WGL, and GLU extensions as well
249
as a table of visuals aka. pixel formats. Pbuffer and MRT capable
250
visuals are also included. For additional usage information, type
251
<tt>visualinfo -h</tt>.
254
<h3>glewinfo: extension verification utility</h3>
257
<tt>glewinfo</tt> allows you to verify the entry points for the
258
extensions supported on your platform. The Windows version
259
reports the results to a text file called <tt>glewinfo.txt</tt>. The
260
Unix version prints the results to <tt>stdout</tt>.
263
<p>Windows usage:</p>
264
<blockquote><pre>glewinfo [-pf <id>]</pre></blockquote>
266
<p>where <tt><id></tt> is the pixel format id for which the
267
capabilities are displayed.</p>
270
<blockquote><pre>glewinfo [-display <dpy>] [-visual <id>]</pre></blockquote>
272
<p>where <tt><dpy></tt> is the X11 display and <tt><id></tt> is
273
the visual id for which the capabilities are displayed.</p>