[1648] | 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 | <!-- <img src="new.png" height="12" alt="NEW!"> --> |
---|
| 9 | <html> |
---|
| 10 | <head> |
---|
| 11 | <title> |
---|
| 12 | GLEW: 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&package_id=67942&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"><b>Basic Usage</b></td></tr> |
---|
| 34 | <tr><td align="center"><a href="advanced.html">Advanced Usage</a></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" |
---|
| 51 | height="35" border="0" alt="OpenGL Logo"></a> |
---|
| 52 | <a href="http://sourceforge.net"> <img |
---|
| 53 | src="http://sourceforge.net/sflogo.php?group_id=67586&type=1" |
---|
| 54 | width="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>Initializing GLEW</h2> |
---|
| 68 | <p> |
---|
| 69 | First you need to create a valid OpenGL rendering context and call |
---|
| 70 | <tt>glewInit()</tt> to initialize the extension entry points. If |
---|
| 71 | <tt>glewInit()</tt> returns <tt>GLEW_OK</tt>, the initialization |
---|
| 72 | succeeded and you can use the available extensions as well as core |
---|
| 73 | OpenGL functionality. For example: |
---|
| 74 | </p> |
---|
| 75 | |
---|
| 76 | <p class="pre"> |
---|
| 77 | #include <GL/glew.h><br> |
---|
| 78 | #include <GL/glut.h><br> |
---|
| 79 | ...<br> |
---|
| 80 | glutInit(&argc, argv);<br> |
---|
| 81 | glutCreateWindow("GLEW Test");<br> |
---|
| 82 | GLenum err = glewInit();<br> |
---|
| 83 | if (GLEW_OK != err)<br> |
---|
| 84 | {<br> |
---|
| 85 | /* Problem: glewInit failed, something is seriously wrong. */<br> |
---|
| 86 | fprintf(stderr, "Error: %s\n", glewGetErrorString(err));<br> |
---|
| 87 | ...<br> |
---|
| 88 | }<br> |
---|
| 89 | fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));<br> |
---|
| 90 | </p> |
---|
| 91 | |
---|
| 92 | <h2>Checking for Extensions</h2> |
---|
| 93 | |
---|
| 94 | <p> |
---|
| 95 | Starting from GLEW 1.1.0, you can find out if a particular extension |
---|
| 96 | is available on your platform by querying globally defined variables |
---|
| 97 | of the form <tt>GLEW_{extension_name}</tt>: |
---|
| 98 | </p> |
---|
| 99 | |
---|
| 100 | <p class="pre"> |
---|
| 101 | if (GLEW_ARB_vertex_program)<br> |
---|
| 102 | {<br> |
---|
| 103 | /* It is safe to use the ARB_vertex_program extension here. */<br> |
---|
| 104 | glGenProgramsARB(...);<br> |
---|
| 105 | }<br> |
---|
| 106 | </p> |
---|
| 107 | |
---|
| 108 | <p> |
---|
| 109 | <b>In GLEW 1.0.x, a global structure was used for this task. To ensure |
---|
| 110 | binary compatibility between releases, the struct was replaced with a |
---|
| 111 | set of variables.</b> |
---|
| 112 | </p> |
---|
| 113 | |
---|
| 114 | <p> |
---|
| 115 | You can also check for core OpenGL functionality. For example, to |
---|
| 116 | see if OpenGL 1.3 is supported, do the following: |
---|
| 117 | </p> |
---|
| 118 | |
---|
| 119 | <p class="pre"> |
---|
| 120 | if (GLEW_VERSION_1_3)<br> |
---|
| 121 | {<br> |
---|
| 122 | /* Yay! OpenGL 1.3 is supported! */<br> |
---|
| 123 | }<br> |
---|
| 124 | </p> |
---|
| 125 | |
---|
| 126 | <p> |
---|
| 127 | In general, you can check if <tt>GLEW_{extension_name}</tt> or |
---|
| 128 | <tt>GLEW_VERSION_{version}</tt> is true or false. |
---|
| 129 | </p> |
---|
| 130 | |
---|
| 131 | <p> |
---|
| 132 | It is also possible to perform extension checks from string |
---|
| 133 | input. Starting from the 1.3.0 release, use <tt>glewIsSupported</tt> |
---|
| 134 | to check if the required core or extension functionality is |
---|
| 135 | available: |
---|
| 136 | </p> |
---|
| 137 | |
---|
| 138 | <p class="pre"> |
---|
| 139 | if (glewIsSupported("GL_VERSION_1_4 GL_ARB_point_sprite"))<br> |
---|
| 140 | {<br> |
---|
| 141 | /* Great, we have OpenGL 1.4 + point sprites. */<br> |
---|
| 142 | }<br> |
---|
| 143 | </p> |
---|
| 144 | |
---|
| 145 | <p> |
---|
| 146 | For extensions only, <tt>glewGetExtension</tt> provides a slower alternative |
---|
| 147 | (GLEW 1.0.x-1.2.x). <b>Note that in the 1.3.0 release </b> |
---|
| 148 | <tt>glewGetExtension</tt> <b>was replaced with </b> |
---|
| 149 | <tt>glewIsSupported</tt>. |
---|
| 150 | </p> |
---|
| 151 | |
---|
| 152 | <p class="pre"> |
---|
| 153 | if (glewGetExtension("GL_ARB_fragment_program"))<br> |
---|
| 154 | {<br> |
---|
| 155 | /* Looks like ARB_fragment_program is supported. */<br> |
---|
| 156 | }<br> |
---|
| 157 | </p> |
---|
| 158 | |
---|
| 159 | <h2>Experimental Drivers</h2> |
---|
| 160 | |
---|
| 161 | <p> |
---|
| 162 | GLEW obtains information on the supported extensions from the graphics |
---|
| 163 | driver. Experimental or pre-release drivers, however, might not |
---|
| 164 | report every available extension through the standard mechanism, in |
---|
| 165 | which case GLEW will report it unsupported. To circumvent this |
---|
| 166 | situation, the <tt>glewExperimental</tt> global switch can be turned |
---|
| 167 | on by setting it to <tt>GL_TRUE</tt> before calling |
---|
| 168 | <tt>glewInit()</tt>, which ensures that all extensions with valid |
---|
| 169 | entry points will be exposed. |
---|
| 170 | </p> |
---|
| 171 | |
---|
| 172 | <h2>Platform Specific Extensions</h2> |
---|
| 173 | |
---|
| 174 | <p> |
---|
| 175 | Platform specific extensions are separated into two header files: |
---|
| 176 | <tt>wglew.h</tt> and <tt>glxew.h</tt>, which define the available |
---|
| 177 | <tt>WGL</tt> and <tt>GLX</tt> extensions. To determine if a certain |
---|
| 178 | extension is supported, query <tt>WGLEW_{extension name}</tt> or |
---|
| 179 | <tt>GLXEW_{extension_name}</tt>. For example: |
---|
| 180 | </p> |
---|
| 181 | |
---|
| 182 | <p class="pre"> |
---|
| 183 | #include <GL/wglew.h><br> |
---|
| 184 | <br> |
---|
| 185 | if (WGLEW_ARB_pbuffer)<br> |
---|
| 186 | {<br> |
---|
| 187 | /* OK, we can use pbuffers. */<br> |
---|
| 188 | }<br> |
---|
| 189 | else<br> |
---|
| 190 | {<br> |
---|
| 191 | /* Sorry, pbuffers will not work on this platform. */<br> |
---|
| 192 | }<br> |
---|
| 193 | </p> |
---|
| 194 | |
---|
| 195 | <p> |
---|
| 196 | Alternatively, use <tt>wglewIsSupported</tt> or |
---|
| 197 | <tt>glxewIsSupported</tt> to check for extensions from a string: |
---|
| 198 | </p> |
---|
| 199 | |
---|
| 200 | <p class="pre"> |
---|
| 201 | if (wglewIsSupported("WGL_ARB_pbuffer"))<br> |
---|
| 202 | {<br> |
---|
| 203 | /* OK, we can use pbuffers. */<br> |
---|
| 204 | }<br> |
---|
| 205 | </p> |
---|
| 206 | |
---|
| 207 | <h2>Utilities</h2> |
---|
| 208 | |
---|
| 209 | <p> |
---|
| 210 | GLEW provides two command-line utilities: one for creating a list of |
---|
| 211 | available extensions and visuals; and another for verifying extension |
---|
| 212 | entry points. |
---|
| 213 | </p> |
---|
| 214 | |
---|
| 215 | <h3>visualinfo: extensions and visuals</h3> |
---|
| 216 | |
---|
| 217 | <p> |
---|
| 218 | <tt>visualinfo</tt> is an extended version of <tt>glxinfo</tt>. The |
---|
| 219 | Windows version creates a file called <tt>visualinfo.txt</tt>, which |
---|
| 220 | contains a list of available OpenGL, WGL, and GLU extensions as well |
---|
| 221 | as a table of visuals aka. pixel formats. Pbuffer and MRT capable |
---|
| 222 | visuals are also included. For additional usage information, type |
---|
| 223 | <tt>visualinfo -h</tt>. |
---|
| 224 | </p> |
---|
| 225 | |
---|
| 226 | <h3>glewinfo: extension verification utility</h3> |
---|
| 227 | |
---|
| 228 | <p> |
---|
| 229 | <tt>glewinfo</tt> allows you to verify the entry points for the |
---|
| 230 | extensions supported on your platform. The Windows version |
---|
| 231 | reports the results to a text file called <tt>glewinfo.txt</tt>. The |
---|
| 232 | Unix version prints the results to <tt>stdout</tt>. |
---|
| 233 | </p> |
---|
| 234 | |
---|
| 235 | <p>Windows usage:</p> |
---|
| 236 | <blockquote><pre>glewinfo [-pf <id>]</pre></blockquote> |
---|
| 237 | |
---|
| 238 | <p>where <tt><id></tt> is the pixel format id for which the |
---|
| 239 | capabilities are displayed.</p> |
---|
| 240 | |
---|
| 241 | <p>Unix usage:</p> |
---|
| 242 | <blockquote><pre>glewinfo [-display <dpy>] [-visual <id>]</pre></blockquote> |
---|
| 243 | |
---|
| 244 | <p>where <tt><dpy></tt> is the X11 display and <tt><id></tt> is |
---|
| 245 | the visual id for which the capabilities are displayed.</p> |
---|
| 246 | |
---|
| 247 | </td> |
---|
| 248 | </tr> |
---|
| 249 | |
---|
| 250 | </table> |
---|
| 251 | |
---|
| 252 | </body> |
---|