|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
The OpenGL Extension Wrangler Library
|
|
kusano |
7d535a |
Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee="" org=""></milan>
|
|
kusano |
7d535a |
Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org=""></mmagallo[]debian>
|
|
kusano |
7d535a |
Copyright (C) 2002, Lev Povalahev
|
|
kusano |
7d535a |
All rights reserved.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Redistribution and use in source and binary forms, with or without
|
|
kusano |
7d535a |
modification, are permitted provided that the following conditions are met:
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
* Redistributions of source code must retain the above copyright notice,
|
|
kusano |
7d535a |
this list of conditions and the following disclaimer.
|
|
kusano |
7d535a |
* Redistributions in binary form must reproduce the above copyright notice,
|
|
kusano |
7d535a |
this list of conditions and the following disclaimer in the documentation
|
|
kusano |
7d535a |
and/or other materials provided with the distribution.
|
|
kusano |
7d535a |
* The name of the author may be used to endorse or promote products
|
|
kusano |
7d535a |
derived from this software without specific prior written permission.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
kusano |
7d535a |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
kusano |
7d535a |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
kusano |
7d535a |
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
kusano |
7d535a |
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
kusano |
7d535a |
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
kusano |
7d535a |
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
kusano |
7d535a |
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
kusano |
7d535a |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
kusano |
7d535a |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
kusano |
7d535a |
THE POSSIBILITY OF SUCH DAMAGE.
|
|
kusano |
7d535a |
-->
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
<title>GLEW: The OpenGL Extension Wrangler Library</title>
|
|
kusano |
7d535a |
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
|
|
kusano |
7d535a |
<link href="glew.css" rel="stylesheet" type="text/css">
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Latest Release: 1.9.0
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Download
|
|
kusano |
7d535a |
Usage
|
|
kusano |
7d535a |
Building
|
|
kusano |
7d535a |
Installation
|
|
kusano |
7d535a |
Source Generation
|
|
kusano |
7d535a |
Credits & Copyright
|
|
kusano |
7d535a |
Change Log
|
|
kusano |
7d535a |
Project Page
|
|
kusano |
7d535a |
Mailing Lists
|
|
kusano |
7d535a |
Bug Tracker
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Last Update: 08-06-12
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
height="35" border="0" alt="OpenGL Logo">
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
src="http://sourceforge.net/sflogo.php?group_id=67586&type=1"
|
|
kusano |
7d535a |
width="88" height="31" border="0" alt="SourceForge Logo">
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
href="http://sourceforge.net/donate/index.php?group_id=67586">
|
|
kusano |
7d535a |
src="http://images.sourceforge.net/images/project-support.jpg"
|
|
kusano |
7d535a |
width="88" height="32" border="0" alt="Support This Project"> -->
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
The OpenGL Extension Wrangler Library
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Automatic Code Generation
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Starting from release 1.1.0, the source code and parts of the
|
|
kusano |
7d535a |
documentation are automatically generated from the extension
|
|
kusano |
7d535a |
specifications in a two-step process. In the first step,
|
|
kusano |
7d535a |
specification files from the OpenGL registry are downloaded and
|
|
kusano |
7d535a |
parsed. Skeleton descriptors are created for each extension. These
|
|
kusano |
7d535a |
descriptors contain all necessary information for creating the source
|
|
kusano |
7d535a |
code and documentation in a simple and compact format, including the
|
|
kusano |
7d535a |
name of the extension, url link to the specification, tokens, function
|
|
kusano |
7d535a |
declarations, typedefs and struct definitions. In the second step,
|
|
kusano |
7d535a |
the header files as well as the library and glewinfo source are
|
|
kusano |
7d535a |
generated from the descriptor files. The code generation scripts are
|
|
kusano |
7d535a |
located in the <tt>auto</tt> subdirectory.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
The code generation scripts require GNU make, wget, and perl. On
|
|
kusano |
7d535a |
Windows, the simplest way to get access to these tools is to install
|
|
kusano |
7d535a |
Cygwin, but make sure that the
|
|
kusano |
7d535a |
root directory is mounted in binary mode. The makefile in the
|
|
kusano |
7d535a |
<tt>auto</tt> directory provides the following build targets:
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
<tt>make</tt>
|
|
kusano |
7d535a |
Create the source files from the descriptors. If the
|
|
kusano |
7d535a |
descriptors do not exist, create them from the spec files. If the spec
|
|
kusano |
7d535a |
files do not exist, download them from the OpenGL repository.
|
|
kusano |
7d535a |
<tt>make clean</tt>
|
|
kusano |
7d535a |
Delete the source files.
|
|
kusano |
7d535a |
<tt>make clobber</tt>
|
|
kusano |
7d535a |
Delete the source files and the descriptors.
|
|
kusano |
7d535a |
<tt>make destroy</tt>
|
|
kusano |
7d535a |
Delete the source files, the descriptors, and the spec files.
|
|
kusano |
7d535a |
<tt>make custom</tt>
|
|
kusano |
7d535a |
Create the source files for the extensions
|
|
kusano |
7d535a |
listed in <tt>auto/custom.txt</tt>. See "Custom Code
|
|
kusano |
7d535a |
Generation" below for more details.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Adding a New Extension
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
To add a new extension, create a descriptor file for the extension in
|
|
kusano |
7d535a |
<tt>auto/core</tt> and rerun the code generation scripts by typing
|
|
kusano |
7d535a |
<tt>make clean; make</tt> in the <tt>auto</tt> directory.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
The format of the descriptor file is given below. Items in
|
|
kusano |
7d535a |
brackets are optional.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
<Extension Name>
|
|
kusano |
7d535a |
[<URL of Specification File>]
|
|
kusano |
7d535a |
[<Token Name> <Token Value>]
|
|
kusano |
7d535a |
[<Token Name> <Token Value>]
|
|
kusano |
7d535a |
...
|
|
kusano |
7d535a |
[<Typedef>]
|
|
kusano |
7d535a |
[<Typedef>]
|
|
kusano |
7d535a |
...
|
|
kusano |
7d535a |
[<Function Signature>]
|
|
kusano |
7d535a |
[<Function Signature>]
|
|
kusano |
7d535a |
...
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
[<Function Definition>]
|
|
kusano |
7d535a |
... -->
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Note that <tt>Function Definitions</tt> are copied to the header files
|
|
kusano |
7d535a |
without changes and have to be terminated with a semicolon. In
|
|
kusano |
7d535a |
contrast, <tt>Tokens</tt>, <tt>Function signatures</tt>, and
|
|
kusano |
7d535a |
<tt>Typedefs</tt> should not be terminated with a semicolon.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
-->
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Take a look at one of the files in <tt>auto/core</tt> for an
|
|
kusano |
7d535a |
example. Note that typedefs and function signatures should not be
|
|
kusano |
7d535a |
terminated with a semicolon.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Custom Code Generation
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Starting from GLEW 1.3.0, it is possible to control which extensions
|
|
kusano |
7d535a |
to include in the libarary by specifying a list in
|
|
kusano |
7d535a |
<tt>auto/custom.txt</tt>. This is useful when you do not need all the
|
|
kusano |
7d535a |
extensions and would like to reduce the size of the source files.
|
|
kusano |
7d535a |
Type <tt>make clean; make custom</tt> in the <tt>auto</tt> directory
|
|
kusano |
7d535a |
to rerun the scripts with the custom list of extensions.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
For example, the following is the list of extensions needed to get GLEW and the
|
|
kusano |
7d535a |
utilities to compile.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
WGL_ARB_extensions_string
|
|
kusano |
7d535a |
WGL_ARB_multisample
|
|
kusano |
7d535a |
WGL_ARB_pixel_format
|
|
kusano |
7d535a |
WGL_ARB_pbuffer
|
|
kusano |
7d535a |
WGL_EXT_extensions_string
|
|
kusano |
7d535a |
WGL_ATI_pixel_format_float
|
|
kusano |
7d535a |
WGL_NV_float_buffer
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Multiple Rendering Contexts (GLEW MX)
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Starting with release 1.2.0, thread-safe support for multiple
|
|
kusano |
7d535a |
rendering contexts, possibly with different capabilities, is
|
|
kusano |
7d535a |
available. Since this is not required by most users, it is not added
|
|
kusano |
7d535a |
to the binary releases to maintain compatibility between different
|
|
kusano |
7d535a |
versions. To include multi-context support, you have to do the
|
|
kusano |
7d535a |
following:
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Compile and use GLEW with the <tt>GLEW_MX</tt> preprocessor token
|
|
kusano |
7d535a |
defined.
|
|
kusano |
7d535a |
For each rendering context, create a <tt>GLEWContext</tt> object
|
|
kusano |
7d535a |
that will be available as long as the rendering context exists.
|
|
kusano |
7d535a |
Define a macro or function called <tt>glewGetContext()</tt> that
|
|
kusano |
7d535a |
returns a pointer to the <tt>GLEWContext</tt> object associated with
|
|
kusano |
7d535a |
the rendering context from which OpenGL/WGL/GLX calls are issued. This
|
|
kusano |
7d535a |
dispatch mechanism is primitive, but generic.
|
|
kusano |
7d535a |
Make sure that you call <tt>glewInit()</tt> after creating the
|
|
kusano |
7d535a |
<tt>GLEWContext</tt> object in each rendering context. Note, that the
|
|
kusano |
7d535a |
<tt>GLEWContext</tt> pointer returned by <tt>glewGetContext()</tt> has
|
|
kusano |
7d535a |
to reside in global or thread-local memory.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Note that according to the
|
|
kusano |
7d535a |
href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/ntopnglr_6yer.asp">MSDN
|
|
kusano |
7d535a |
WGL documentation, you have to initialize the entry points for
|
|
kusano |
7d535a |
every rendering context that use pixel formats with different
|
|
kusano |
7d535a |
capabilities For example, the pixel formats provided by the generic
|
|
kusano |
7d535a |
software OpenGL implementation by Microsoft vs. the hardware
|
|
kusano |
7d535a |
accelerated pixel formats have different capabilities. GLEW by
|
|
kusano |
7d535a |
default ignores this requirement, and does not define per-context
|
|
kusano |
7d535a |
entry points (you can however do this using the steps described
|
|
kusano |
7d535a |
above). Assuming a global namespace for the entry points works in
|
|
kusano |
7d535a |
most situations, because typically all hardware accelerated pixel
|
|
kusano |
7d535a |
formats provide the same entry points and capabilities. This means
|
|
kusano |
7d535a |
that unless you use the multi-context version of GLEW, you need to
|
|
kusano |
7d535a |
call <tt>glewInit()</tt> only once in your program, or more precisely,
|
|
kusano |
7d535a |
once per process.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Separate Namespace
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
To avoid name clashes when linking with libraries that include the
|
|
kusano |
7d535a |
same symbols, extension entry points are declared in a separate
|
|
kusano |
7d535a |
namespace (release 1.1.0 and up). This is achieved by aliasing OpenGL
|
|
kusano |
7d535a |
function names to their GLEW equivalents. For instance,
|
|
kusano |
7d535a |
<tt>glFancyFunction</tt> is simply an alias to
|
|
kusano |
7d535a |
<tt>glewFancyFunction</tt>. The separate namespace does not effect
|
|
kusano |
7d535a |
token and function pointer definitions.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Known Issues
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
GLEW requires GLX 1.2 for compatibility with GLUT.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|