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.

127 lines
4.8KB

  1. <h2>Installation</h2>
  2. <p>
  3. To use the shared library version of GLEW, you need to copy the
  4. headers and libraries into their destination directories. On Windows
  5. this typically boils down to copying:
  6. </p>
  7. <table border="0" cellpadding="0" cellspacing="0" align="center"> <!-- bgcolor="#f0f0f0" -->
  8. <tr><td align="left"><tt>bin/glew32.dll</tt></td><td>&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;&nbsp;&nbsp;&nbsp;</td>
  9. <td align="left"><tt>%SystemRoot%/system32</tt></td></tr>
  10. <tr><td align="left"><tt>lib/glew32.lib</tt></td><td>&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;&nbsp;&nbsp;&nbsp;</td>
  11. <td align="left"><tt>{VC Root}/Lib</tt></td></tr>
  12. <tr><td align="left"><tt>include/GL/glew.h</tt></td><td>&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;&nbsp;&nbsp;&nbsp;</td>
  13. <td align="left"><tt>{VC Root}/Include/GL</tt></td></tr>
  14. <tr><td align="left"><tt>include/GL/wglew.h</tt></td><td>&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;&nbsp;&nbsp;&nbsp;</td>
  15. <td align="left"><tt>{VC Root}/Include/GL</tt></td></tr>
  16. </table>
  17. <p>
  18. </p>
  19. <p>
  20. where <tt>{VC Root}</tt> is the Visual C++ root directory, typically
  21. <tt>C:/Program Files/Microsoft Visual Studio/VC98</tt> for Visual
  22. Studio 6.0 or <tt>C:/Program Files/Microsoft Visual
  23. Studio .NET 2003/Vc7/PlatformSDK</tt> for Visual Studio .NET.
  24. </p>
  25. <p>
  26. On Unix, typing <tt>make install</tt> will attempt to install GLEW
  27. into <tt>/usr/include/GL</tt> and <tt>/usr/lib</tt>. You can
  28. customize the installation target via the <tt>GLEW_DEST</tt>
  29. environment variable if you do not have write access to these
  30. directories.
  31. </p>
  32. <h2>Building Your Project with GLEW</h2>
  33. <p>
  34. There are two ways to build your project with GLEW.
  35. </p>
  36. <h3>Including the source files / project file</h3>
  37. <p>
  38. The simpler but less flexible way is to include <tt>glew.h</tt> and
  39. <tt>glew.c</tt> into your project. On Windows, you also need to
  40. define the <tt>GLEW_STATIC</tt> preprocessor token when building a
  41. static library or executable, and the <tt>GLEW_BUILD</tt> preprocessor
  42. token when building a dll. You also need to replace
  43. <tt>&lt;GL/gl.h&gt;</tt> and <tt>&lt;GL/glu.h&gt;</tt> with
  44. <tt>&lt;glew.h&gt;</tt> in your code and set the appropriate include
  45. flag (<tt>-I</tt>) to tell the compiler where to look for it. For
  46. example:
  47. </p>
  48. <p class="pre">
  49. #include &lt;glew.h&gt;<br>
  50. #include &lt;GL/glut.h&gt;<br>
  51. &lt;gl, glu, and glut functionality is available here&gt;<br>
  52. </p>
  53. <p>
  54. Depending on where you put <tt>glew.h</tt> you may also need to change
  55. the include directives in <tt>glew.c</tt>. Note that if you are using
  56. GLEW together with GLUT, you have to include <tt>glew.h</tt> first.
  57. In addition, <tt>glew.h</tt> includes <tt>glu.h</tt>, so you do not
  58. need to include it separately.
  59. </p>
  60. <p>
  61. On Windows, you also have the option of adding the supplied project
  62. file <tt>glew_static.dsp</tt> to your workspace (solution) and compile
  63. it together with your other projects. In this case you also need to
  64. change the <tt>GLEW_BUILD</tt> preprocessor constant to
  65. <tt>GLEW_STATIC</tt> when building a static library or executable,
  66. otherwise you get build errors.
  67. </p>
  68. <p>
  69. <b>Note that GLEW does not use the C
  70. runtime library, so it does not matter which version (single-threaded,
  71. multi-threaded or multi-threaded DLL) it is linked with (without
  72. debugging information). It is, however, always a good idea to compile all
  73. your projects including GLEW with the same C runtime settings.</b>
  74. </p>
  75. <h3>Using GLEW as a shared library</h3>
  76. <p>
  77. Alternatively, you can use the provided project files / makefile to
  78. build a separate shared library you can link your projects with later.
  79. In this case the best practice is to install <tt>glew.h</tt>,
  80. <tt>glew32.lib</tt>, and <tt>glew32.dll</tt> / <tt>libGLEW.so</tt> to
  81. where the OpenGL equivalents <tt>gl.h</tt>, <tt>opengl32.lib</tt>, and
  82. <tt>opengl32.dll</tt> / <tt>libGL.so</tt> are located. Note that you
  83. need administrative privileges to do this. If you do not have
  84. administrator access and your system administrator will not do it for
  85. you, you can install GLEW into your own lib and include subdirectories
  86. and tell the compiler where to find it. Then you can just replace
  87. <tt>&lt;GL/gl.h&gt;</tt> with <tt>&lt;GL/glew.h&gt;</tt> in your
  88. program:
  89. </p>
  90. <p class="pre">
  91. #include &lt;GL/glew.h&gt;<br>
  92. #include &lt;GL/glut.h&gt;<br>
  93. &lt;gl, glu, and glut functionality is available here&gt;<br>
  94. </p>
  95. <p>
  96. or:
  97. </p>
  98. <p class="pre">
  99. #include &lt;GL/glew.h&gt;<br>
  100. &lt;gl and glu functionality is available here&gt;<br>
  101. </p>
  102. <p>
  103. Remember to link your project with <tt>glew32.lib</tt>,
  104. <tt>glu32.lib</tt>, and <tt>opengl32.lib</tt> on Windows and
  105. <tt>libGLEW.so</tt>, <tt>libGLU.so</tt>, and <tt>libGL.so</tt> on
  106. Unix (<tt>-lGLEW -lGLU -lGL</tt>).
  107. </p>
  108. <p>
  109. It is important to keep in mind that <tt>glew.h</tt> includes neither
  110. <tt>windows.h</tt> nor <tt>gl.h</tt>. Also, GLEW will warn you by
  111. issuing a preprocessor error in case you have included <tt>gl.h</tt>,
  112. <tt>glext.h</tt>, or <tt>glATI.h</tt> before <tt>glew.h</tt>.
  113. </p>