advanced.html 11 KB

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