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.

131 lines
4.7KB

  1. <h2>Automatic Code Generation</h2>
  2. <p>
  3. Starting from release 1.1.0, the source code and parts of the
  4. documentation are automatically generated from the extension
  5. specifications in a two-step process. In the first step,
  6. specification files from the OpenGL registry are downloaded and
  7. parsed. Skeleton descriptors are created for each extension. These
  8. descriptors contain all necessary information for creating the source
  9. code and documentation in a simple and compact format, including the
  10. name of the extension, url link to the specification, tokens, function
  11. declarations, typedefs and struct definitions. In the second step,
  12. the header files as well as the library and glewinfo source are
  13. generated from the descriptor files. The code generation scripts are
  14. located in the <tt>auto</tt> subdirectory.
  15. </p>
  16. <p>
  17. The code generation scripts require GNU make, wget, and perl. On
  18. Windows, the simplest way to get access to these tools is to install
  19. <a href="http://www.cygwin.com/">Cygwin</a>, but make sure that the
  20. root directory is mounted in binary mode. The makefile in the
  21. <tt>auto</tt> directory provides the following build targets:
  22. </p>
  23. <table border=0 cellpadding=0 cellspacing=5>
  24. <tr><td align="left" valign="top"><tt>make</tt></td>
  25. <td align=left>Create the source files from the descriptors.<br/> If the
  26. descriptors do not exist, create them from the spec files.<br/> If the spec
  27. files do not exist, download them from the OpenGL repository.</td></tr>
  28. <tr><td align="left" valign="top"><tt>make&nbsp;clean</tt></td>
  29. <td align=left>Delete the source files.</td></tr>
  30. <tr><td align="left" valign="top"><tt>make&nbsp;clobber</tt></td>
  31. <td align=left>Delete the source files and the descriptors.</td></tr>
  32. <tr><td align="left" valign="top"><tt>make&nbsp;destroy</tt></td>
  33. <td align=left>Delete the source files, the descriptors, and the spec files.</td></tr>
  34. <tr><td align="left" valign="top"><tt>make&nbsp;custom</tt></td>
  35. <td align=left>Create the source files for the extensions
  36. listed in <tt>auto/custom.txt</tt>.<br/> See "Custom Code
  37. Generation" below for more details.</td></tr>
  38. </table>
  39. <h3>Adding a New Extension</h3>
  40. <p>
  41. To add a new extension, create a descriptor file for the extension in
  42. <tt>auto/core</tt> and rerun the code generation scripts by typing
  43. <tt>make clean; make</tt> in the <tt>auto</tt> directory.
  44. </p>
  45. <p>
  46. The format of the descriptor file is given below. Items in
  47. brackets are optional.
  48. </p>
  49. <p class="pre">
  50. &lt;Extension Name&gt;<br>
  51. [&lt;URL of Specification File&gt;]<br>
  52. &nbsp;&nbsp;&nbsp;&nbsp;[&lt;Token Name&gt; &lt;Token Value&gt;]<br>
  53. &nbsp;&nbsp;&nbsp;&nbsp;[&lt;Token Name&gt; &lt;Token Value&gt;]<br>
  54. &nbsp;&nbsp;&nbsp;&nbsp;...<br>
  55. &nbsp;&nbsp;&nbsp;&nbsp;[&lt;Typedef&gt;]<br>
  56. &nbsp;&nbsp;&nbsp;&nbsp;[&lt;Typedef&gt;]<br>
  57. &nbsp;&nbsp;&nbsp;&nbsp;...<br>
  58. &nbsp;&nbsp;&nbsp;&nbsp;[&lt;Function Signature&gt;]<br>
  59. &nbsp;&nbsp;&nbsp;&nbsp;[&lt;Function Signature&gt;]<br>
  60. &nbsp;&nbsp;&nbsp;&nbsp;...<br>
  61. <!-- &nbsp;&nbsp;&nbsp;&nbsp;[&lt;Function Definition&gt;]<br>
  62. &nbsp;&nbsp;&nbsp;&nbsp;[&lt;Function Definition&gt;]<br>
  63. &nbsp;&nbsp;&nbsp;&nbsp;...<br> -->
  64. </p>
  65. <!--
  66. <p>
  67. Note that <tt>Function Definitions</tt> are copied to the header files
  68. without changes and have to be terminated with a semicolon. In
  69. contrast, <tt>Tokens</tt>, <tt>Function signatures</tt>, and
  70. <tt>Typedefs</tt> should not be terminated with a semicolon.
  71. </p>
  72. -->
  73. <p>
  74. Take a look at one of the files in <tt>auto/core</tt> for an
  75. example. Note that typedefs and function signatures should not be
  76. terminated with a semicolon.
  77. </p>
  78. <h3>Custom Code Generation</h3>
  79. <p>
  80. Starting from GLEW 1.3.0, it is possible to control which extensions
  81. to include in the libarary by specifying a list in
  82. <tt>auto/custom.txt</tt>. This is useful when you do not need all the
  83. extensions and would like to reduce the size of the source files.
  84. Type <tt>make clean; make custom</tt> in the <tt>auto</tt> directory
  85. to rerun the scripts with the custom list of extensions.
  86. </p>
  87. <p>
  88. For example, the following is the list of extensions needed to get GLEW and the
  89. utilities to compile.
  90. </p>
  91. <p class="pre">
  92. WGL_ARB_extensions_string<br>
  93. WGL_ARB_multisample<br>
  94. WGL_ARB_pixel_format<br>
  95. WGL_ARB_pbuffer<br>
  96. WGL_EXT_extensions_string<br>
  97. WGL_ATI_pixel_format_float<br>
  98. WGL_NV_float_buffer<br>
  99. </p>
  100. <h2>Separate Namespace</h2>
  101. <p>
  102. To avoid name clashes when linking with libraries that include the
  103. same symbols, extension entry points are declared in a separate
  104. namespace (release 1.1.0 and up). This is achieved by aliasing OpenGL
  105. function names to their GLEW equivalents. For instance,
  106. <tt>glFancyFunction</tt> is simply an alias to
  107. <tt>glewFancyFunction</tt>. The separate namespace does not effect
  108. token and function pointer definitions.
  109. </p>
  110. <h2>Known Issues</h2>
  111. <p>
  112. GLEW requires GLX 1.2 for compatibility with GLUT.
  113. </p>