You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

283 lines
9.9KB

  1. <!-- begin header.html -->
  2. <!--
  3. The OpenGL Extension Wrangler Library
  4. Copyright (C) 2008-2015, Nigel Stewart <nigels[]users sourceforge net>
  5. Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
  6. Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
  7. Copyright (C) 2002, Lev Povalahev
  8. All rights reserved.
  9. Redistribution and use in source and binary forms, with or without
  10. 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.
  18. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  19. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  22. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  23. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  24. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  25. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  26. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  27. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  28. THE POSSIBILITY OF SUCH DAMAGE.
  29. -->
  30. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html/4/loose.dtd">
  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/2.1.0/">2.1.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">Usage</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"><a href="advanced.html">Source Generation</a></td></tr>
  56. <tr><td align="center"><a href="log.html">Change Log</a></td></tr>
  57. <tr><td align="center"><br></tr>
  58. <tr><td align="center"><a href="https://github.com/nigels-com/glew">GitHub</a></td></tr>
  59. <tr><td align="center"><a href="https://github.com/nigels-com/glew/issues">Issues</a></td></tr>
  60. <tr><td align="center"><a href="https://github.com/nigels-com/glew/pulls">Pull Requests</a></td></tr>
  61. <tr><td align="center"><a href="https://github.com/nigels-com/glew#authors">Authors</a></td></tr>
  62. <tr><td align="center"><a href="https://github.com/nigels-com/glew#copyright-and-licensing">Licensing</a></td></tr>
  63. <tr><td align="center"><br></tr>
  64. <tr><td align="center"><a href="https://sourceforge.net/projects/glew">SourceForge Page</a></td></tr>
  65. </table>
  66. <tr><td align="center"><br></tr>
  67. </table>
  68. </td>
  69. </tr>
  70. <tr>
  71. <td valign="bottom">
  72. <table border="0" width="100%" cellpadding="5" cellspacing="0" align="left">
  73. <tr><td align="center"><i>Last Update: 07-31-17</i></td></tr>
  74. <tr><td align="center">
  75. <a href="http://www.opengl.org"><img src="./ogl_sm.jpg" width="68" height="35" border="0" alt="OpenGL Logo"></a><br/>
  76. <a href="https://github.com/nigels-com/glew"><img src="github.png" width="70" height="29" border="0" alt="GitHub Logo"></a><br/>
  77. <a href="https://travis-ci.org/nigels-com/glew/builds"><img src="travis.png" width="114" height="25" border="0" alt="Travis Logo"></a><br/>
  78. <a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=67586&amp;type=1" width="88" height="31" border="0" alt="SourceForge Logo"></a>
  79. </td>
  80. </tr>
  81. </table>
  82. </td>
  83. </tr>
  84. </table>
  85. </td>
  86. <td bgcolor="#ffffff" align="left" valign="top">
  87. <h1>The OpenGL Extension Wrangler Library</h1>
  88. <!-- end header.html -->
  89. <h2>Initializing GLEW</h2>
  90. <p>
  91. First you need to create a valid OpenGL rendering context and call
  92. <tt>glewInit()</tt> to initialize the extension entry points. If
  93. <tt>glewInit()</tt> returns <tt>GLEW_OK</tt>, the initialization
  94. succeeded and you can use the available extensions as well as core
  95. OpenGL functionality. For example:
  96. </p>
  97. <p class="pre">
  98. #include &lt;GL/glew.h&gt;<br>
  99. #include &lt;GL/glut.h&gt;<br>
  100. ...<br>
  101. glutInit(&amp;argc, argv);<br>
  102. glutCreateWindow("GLEW Test");<br>
  103. GLenum err = glewInit();<br>
  104. if (GLEW_OK != err)<br>
  105. {<br>
  106. &nbsp;&nbsp;/* Problem: glewInit failed, something is seriously wrong. */<br>
  107. &nbsp;&nbsp;fprintf(stderr, "Error: %s\n", glewGetErrorString(err));<br>
  108. &nbsp;&nbsp;...<br>
  109. }<br>
  110. fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));<br>
  111. </p>
  112. <h2>Checking for Extensions</h2>
  113. <p>
  114. Starting from GLEW 1.1.0, you can find out if a particular extension
  115. is available on your platform by querying globally defined variables
  116. of the form <tt>GLEW_{extension_name}</tt>:
  117. </p>
  118. <p class="pre">
  119. if (GLEW_ARB_vertex_program)<br>
  120. {<br>
  121. &nbsp;&nbsp;/* It is safe to use the ARB_vertex_program extension here. */<br>
  122. &nbsp;&nbsp;glGenProgramsARB(...);<br>
  123. }<br>
  124. </p>
  125. <p>
  126. <b>In GLEW 1.0.x, a global structure was used for this task. To ensure
  127. binary compatibility between releases, the struct was replaced with a
  128. set of variables.</b>
  129. </p>
  130. <p>
  131. You can also check for core OpenGL functionality. For example, to
  132. see if OpenGL 1.3 is supported, do the following:
  133. </p>
  134. <p class="pre">
  135. if (GLEW_VERSION_1_3)<br>
  136. {<br>
  137. &nbsp;&nbsp;/* Yay! OpenGL 1.3 is supported! */<br>
  138. }<br>
  139. </p>
  140. <p>
  141. In general, you can check if <tt>GLEW_{extension_name}</tt> or
  142. <tt>GLEW_VERSION_{version}</tt> is true or false.
  143. </p>
  144. <p>
  145. It is also possible to perform extension checks from string
  146. input. Starting from the 1.3.0 release, use <tt>glewIsSupported</tt>
  147. to check if the required core or extension functionality is
  148. available:
  149. </p>
  150. <p class="pre">
  151. if (glewIsSupported("GL_VERSION_1_4&nbsp;&nbsp;GL_ARB_point_sprite"))<br>
  152. {<br>
  153. &nbsp;&nbsp;/* Great, we have OpenGL 1.4 + point sprites. */<br>
  154. }<br>
  155. </p>
  156. <p>
  157. For extensions only, <tt>glewGetExtension</tt> provides a slower alternative
  158. (GLEW 1.0.x-1.2.x). <b>Note that in the 1.3.0 release </b>
  159. <tt>glewGetExtension</tt> <b>was replaced with </b>
  160. <tt>glewIsSupported</tt>.
  161. </p>
  162. <p class="pre">
  163. if (glewGetExtension("GL_ARB_fragment_program"))<br>
  164. {<br>
  165. &nbsp;&nbsp;/* Looks like ARB_fragment_program is supported. */<br>
  166. }<br>
  167. </p>
  168. <h2>Experimental Drivers</h2>
  169. <p>
  170. GLEW obtains information on the supported extensions from the graphics
  171. driver. Experimental or pre-release drivers, however, might not
  172. report every available extension through the standard mechanism, in
  173. which case GLEW will report it unsupported. To circumvent this
  174. situation, the <tt>glewExperimental</tt> global switch can be turned
  175. on by setting it to <tt>GL_TRUE</tt> before calling
  176. <tt>glewInit()</tt>, which ensures that all extensions with valid
  177. entry points will be exposed.
  178. </p>
  179. <h2>Platform Specific Extensions</h2>
  180. <p>
  181. Platform specific extensions are separated into two header files:
  182. <tt>wglew.h</tt> and <tt>glxew.h</tt>, which define the available
  183. <tt>WGL</tt> and <tt>GLX</tt> extensions. To determine if a certain
  184. extension is supported, query <tt>WGLEW_{extension name}</tt> or
  185. <tt>GLXEW_{extension_name}</tt>. For example:
  186. </p>
  187. <p class="pre">
  188. #include &lt;GL/wglew.h&gt;<br>
  189. <br>
  190. if (WGLEW_ARB_pbuffer)<br>
  191. {<br>
  192. &nbsp;&nbsp;/* OK, we can use pbuffers. */<br>
  193. }<br>
  194. else<br>
  195. {<br>
  196. &nbsp;&nbsp;/* Sorry, pbuffers will not work on this platform. */<br>
  197. }<br>
  198. </p>
  199. <p>
  200. Alternatively, use <tt>wglewIsSupported</tt> or
  201. <tt>glxewIsSupported</tt> to check for extensions from a string:
  202. </p>
  203. <p class="pre">
  204. if (wglewIsSupported("WGL_ARB_pbuffer"))<br>
  205. {<br>
  206. &nbsp;&nbsp;/* OK, we can use pbuffers. */<br>
  207. }<br>
  208. </p>
  209. <h2>Utilities</h2>
  210. <p>
  211. GLEW provides two command-line utilities: one for creating a list of
  212. available extensions and visuals; and another for verifying extension
  213. entry points.
  214. </p>
  215. <h3>visualinfo: extensions and visuals</h3>
  216. <p>
  217. <tt>visualinfo</tt> is an extended version of <tt>glxinfo</tt>. The
  218. Windows version creates a file called <tt>visualinfo.txt</tt>, which
  219. contains a list of available OpenGL, WGL, and GLU extensions as well
  220. as a table of visuals aka. pixel formats. Pbuffer and MRT capable
  221. visuals are also included. For additional usage information, type
  222. <tt>visualinfo -h</tt>.
  223. </p>
  224. <h3>glewinfo: extension verification utility</h3>
  225. <p>
  226. <tt>glewinfo</tt> allows you to verify the entry points for the
  227. extensions supported on your platform. The Windows version
  228. reports the results to a text file called <tt>glewinfo.txt</tt>. The
  229. Unix version prints the results to <tt>stdout</tt>.
  230. </p>
  231. <p>Windows usage:</p>
  232. <blockquote><pre>glewinfo [-pf &lt;id&gt;]</pre></blockquote>
  233. <p>where <tt>&lt;id&gt;</tt> is the pixel format id for which the
  234. capabilities are displayed.</p>
  235. <p>Unix usage:</p>
  236. <blockquote><pre>glewinfo [-display &lt;dpy&gt;] [-visual &lt;id&gt;]</pre></blockquote>
  237. <p>where <tt>&lt;dpy&gt;</tt> is the X11 display and <tt>&lt;id&gt;</tt> is
  238. the visual id for which the capabilities are displayed.</p>
  239. <!-- begin footer.html -->
  240. </td></tr></table></body>
  241. <!-- end footer.html -->