source: GTP/trunk/Lib/Illum/GPUObscurancesGT/Libraries/glew/doc/advanced.html @ 1648

Revision 1648, 9.7 KB checked in by igarcia, 18 years ago (diff)
Line 
1<!--
2 Copyright (C) 2002-2005, Milan Ikits <milan ikits[]ieee org>
3 Copyright (C) 2002-2005, Marcelo E. Magallon <mmagallo[]debian org>
4 This documentation may not be modified or redistributed in any
5 form, except by the copyright holder.
6-->
7<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html/4/loose.dtd">
8<!-- &nbsp;<img src="new.png" height="12" alt="NEW!"> -->
9<html>
10<head>
11<title>
12GLEW: The OpenGL Extension Wrangler Library
13</title>
14<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> 
15<link href="glew.css" type="text/css" rel="stylesheet">
16</head>
17<body bgcolor="#fff0d0">
18<table border="0" width="100%" cellpadding="12" cellspacing="8" style="height:100%">
19<tr>
20<td bgcolor="#ffffff" align="left" valign="top" width="200">
21<table border="0" width="100%" cellpadding="0" cellspacing="0" align="left">
22<tr>
23<td valign="top">
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&amp;package_id=67942&amp;release_id=327647">1.3.3</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>
40</table>
41<tr><td align="center"><br></tr>
42</table>
43</td>
44</tr>
45<tr>
46<td valign="bottom">
47<table border="0" width="100%" cellpadding="5" cellspacing="0" align="left">
48<tr><td align="center"><i>Last Update: 05-16-05</i></td></tr>
49<tr><td align="center">
50<a href="http://www.opengl.org"> <img src="./ogl_sm.jpg" width="68"
51height="35" border="0" alt="OpenGL Logo"></a>
52<a href="http://sourceforge.net"> <img
53src="http://sourceforge.net/sflogo.php?group_id=67586&amp;type=1"
54width="88" height="31" border="0" alt="SourceForge Logo"></a>
55</td>
56</tr>
57</table>
58</td>
59</tr>
60</table>
61</td>
62
63<td bgcolor="#ffffff" align="left" valign="top">
64
65<h1>The OpenGL Extension Wrangler Library</h1>
66
67<h2>Automatic Code Generation</h2>
68
69<p>
70Starting from release 1.1.0, the source code and parts of the
71documentation are automatically generated from the extension
72specifications in a two-step process.  In the first step,
73specification files from the OpenGL registry are downloaded and
74parsed. Skeleton descriptors are created for each extension.  These
75descriptors contain all necessary information for creating the source
76code and documentation in a simple and compact format, including the
77name of the extension, url link to the specification, tokens, function
78declarations, typedefs and struct definitions.  In the second step,
79the header files as well as the library and glewinfo source are
80generated from the descriptor files.  The code generation scripts are
81located in the <tt>auto</tt> subdirectory.
82</p>
83
84<p>
85The code generation scripts require GNU make, wget, and perl. On
86Windows, 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
88root directory is mounted in binary mode. The makefile in the
89<tt>auto</tt> directory provides the following build targets:
90</p>
91
92<center>
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>&nbsp;&nbsp;&nbsp;&nbsp;</td>
96<td align=left>Create the source files from the descriptors. If the
97descriptors do not exist, create them from the spec files. If the spec
98files 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>&nbsp;&nbsp;&nbsp;&nbsp;</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>&nbsp;&nbsp;&nbsp;&nbsp;</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>&nbsp;&nbsp;&nbsp;&nbsp;</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>&nbsp;&nbsp;&nbsp;&nbsp;</td>
110<td align=left>Create the source files for the extensions
111listed in <tt>auto/custom.txt</tt>. See "Custom Code
112Generation" below for more details.</td></tr>
113</table>
114</center>
115
116<h3>Adding a New Extension</h3>
117
118<p>
119To 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.
122</p>
123
124<p>
125The format of the descriptor file is given below. Items in
126brackets are optional.
127</p>
128
129<p class="pre">
130&lt;Extension Name&gt;<br>
131[&lt;URL of Specification File&gt;]<br>
132&nbsp;&nbsp;&nbsp;&nbsp;[&lt;Token Name&gt; &lt;Token Value&gt;]<br>
133&nbsp;&nbsp;&nbsp;&nbsp;[&lt;Token Name&gt; &lt;Token Value&gt;]<br>
134&nbsp;&nbsp;&nbsp;&nbsp;...<br>
135&nbsp;&nbsp;&nbsp;&nbsp;[&lt;Typedef&gt;]<br>
136&nbsp;&nbsp;&nbsp;&nbsp;[&lt;Typedef&gt;]<br>
137&nbsp;&nbsp;&nbsp;&nbsp;...<br>
138&nbsp;&nbsp;&nbsp;&nbsp;[&lt;Function Signature&gt;]<br>
139&nbsp;&nbsp;&nbsp;&nbsp;[&lt;Function Signature&gt;]<br>
140&nbsp;&nbsp;&nbsp;&nbsp;...<br>
141<!-- &nbsp;&nbsp;&nbsp;&nbsp;[&lt;Function Definition&gt;]<br>
142&nbsp;&nbsp;&nbsp;&nbsp;[&lt;Function Definition&gt;]<br>
143&nbsp;&nbsp;&nbsp;&nbsp;...<br> -->
144</p>
145
146<!--
147<p>
148Note that <tt>Function Definitions</tt> are copied to the header files
149without changes and have to be terminated with a semicolon. In
150contrast, <tt>Tokens</tt>, <tt>Function signatures</tt>, and
151<tt>Typedefs</tt> should not be terminated with a semicolon.
152</p>
153-->
154
155<p>
156Take a look at one of the files in <tt>auto/core</tt> for an
157example. Note that typedefs and function signatures should not be
158terminated with a semicolon.
159</p>
160
161<h3>Custom Code Generation</h3>
162<p>
163Starting from GLEW 1.3.0, it is possible to control which extensions
164to 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
166extensions and would like to reduce the size of the source files.
167Type <tt>make clean; make custom</tt> in the <tt>auto</tt> directory
168to rerun the scripts with the custom list of extensions.
169</p>
170
171<p>
172For example, the following is the list of extensions needed to get GLEW and the
173utilities to compile.
174</p>
175
176<p class="pre">
177WGL_ARB_extensions_string<br>
178WGL_ARB_multisample<br>
179WGL_ARB_pixel_format<br>
180WGL_ARB_pbuffer<br>
181WGL_EXT_extensions_string<br>
182WGL_ATI_pixel_format_float<br>
183WGL_NV_float_buffer<br>
184</p>
185
186<h2>Multiple Rendering Contexts (GLEW MX)</h2>
187
188<p>Starting with release 1.2.0, thread-safe support for multiple
189rendering contexts, possibly with different capabilities, is
190available. Since this is not required by most users, it is not added
191to the binary releases to maintain compatibility between different
192versions. To include multi-context support, you have to do the
193following:</p>
194<ol>
195<li>Compile and use GLEW with the <tt>GLEW_MX</tt> preprocessor token
196defined.</li>
197<li>For each rendering context, create a <tt>GLEWContext</tt> object
198that will be available as long as the rendering context exists.</li>
199<li>Define a macro or function called <tt>glewGetContext()</tt> that
200returns a pointer to the <tt>GLEWContext</tt> object associated with
201the rendering context from which OpenGL/WGL/GLX calls are issued. This
202dispatch 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
206to reside in global or thread-local memory.
207</ol>
208
209<p>Note that according to the <a
210href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/ntopnglr_6yer.asp">MSDN
211WGL documentation</a>, you have to initialize the entry points for
212every rendering context that use pixel formats with different
213capabilities For example, the pixel formats provided by the generic
214software OpenGL implementation by Microsoft vs. the hardware
215accelerated pixel formats have different capabilities.  <b>GLEW by
216default ignores this requirement, and does not define per-context
217entry points (you can however do this using the steps described
218above).</b> Assuming a global namespace for the entry points works in
219most situations, because typically all hardware accelerated pixel
220formats provide the same entry points and capabilities. This means
221that unless you use the multi-context version of GLEW, you need to
222call <tt>glewInit()</tt> only once in your program, or more precisely,
223once per process.</p>
224
225<h2>Separate Namespace</h2>
226
227<p>
228To avoid name clashes when linking with libraries that include the
229same symbols, extension entry points are declared in a separate
230namespace (release 1.1.0 and up). This is achieved by aliasing OpenGL
231function 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
234token and function pointer definitions.
235</p>
236
237<h2>Known Issues</h2>
238
239<p>
240GLEW requires GLX 1.2 for compatibility with GLUT.
241</p>
242
243</td>
244</tr>
245
246</table>
247
248</body>
Note: See TracBrowser for help on using the repository browser.