glew/doc/install.html
2023-10-07 12:28:52 +10:00

228 lines
9.4 KiB
HTML

<!-- begin header.html -->
<!--
The OpenGL Extension Wrangler Library
Copyright (C) 2008-2023, Nigel Stewart <nigels[]nigels.com>
Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
Copyright (C) 2002, Lev Povalahev
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The name of the author may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html/4/loose.dtd">
<html>
<head>
<title>GLEW: The OpenGL Extension Wrangler Library</title>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<link href="glew.css" type="text/css" rel="stylesheet">
</head>
<body bgcolor="#fff0d0">
<table border="0" width="100%" cellpadding="12" cellspacing="8" style="height:100%">
<tr>
<td bgcolor="#ffffff" align="left" valign="top" width="200">
<table border="0" width="100%" cellpadding="0" cellspacing="0" align="left">
<tr>
<td valign="top">
<table border="0" width="100%" cellpadding="0" cellspacing="0" align="left">
<tr><td align="center"><i>Latest Release: <a href="https://github.com/nigels-com/glew/releases/tag/glew-2.3.0">2.3.0</a></i></td></tr>
<tr><td align="center"><br></td></tr>
<tr><td align="center"><img src="./glew.png" alt="GLEW Logo" width="97" height="75"></td></tr>
<tr><td align="center"><br></td></tr>
<tr><td align="center">
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr><td align="center"><a href="index.html">Download</a></td></tr>
<tr><td align="center"><a href="basic.html">Usage</a></td></tr>
<tr><td align="center"><a href="build.html">Building</a></td></tr>
<tr><td align="center">Installation</td></tr>
<tr><td align="center"><a href="advanced.html">Source Generation</a></td></tr>
<tr><td align="center"><br></tr>
<tr><td align="center"><a href="https://github.com/nigels-com/glew">GitHub</a></td></tr>
<tr><td align="center"><a href="https://github.com/nigels-com/glew/issues">Issues</a></td></tr>
<tr><td align="center"><a href="https://github.com/nigels-com/glew/pulls">Pull Requests</a></td></tr>
<tr><td align="center"><a href="https://github.com/nigels-com/glew/releases">Releases</a></td></tr>
<tr><td align="center"><br></tr>
<tr><td align="center"><br>Also</tr>
<tr><td align="center"><a href="https://github.com/Perlmint/glew-cmake">Perlmint/glew-cmake</a></td></tr>
<tr><td align="center"><br></tr>
</table>
<tr><td align="center"><br></tr>
</table>
</td>
</tr>
<tr>
<td valign="bottom">
<table border="0" width="100%" cellpadding="5" cellspacing="0" align="left">
<tr><td align="center"><i>Last Update: 10-10-23</i></td></tr>
<tr><td align="center">
<a href="http://www.opengl.org"><img src="./ogl_sm.jpg" width="68" height="35" border="0" alt="OpenGL Logo"></a><br/>
<a href="https://github.com/nigels-com/glew"><img src="github.png" width="70" height="29" border="0" alt="GitHub Logo"></a><br/>
<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>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td bgcolor="#ffffff" align="left" valign="top">
<h1>The OpenGL Extension Wrangler Library</h1>
<!-- end header.html -->
<h2>Installation</h2>
<p>
To use the shared library version of GLEW, you need to copy the
headers and libraries into their destination directories. On Windows
this typically boils down to copying:
</p>
<table border="0" cellpadding="0" cellspacing="0" align="center"> <!-- bgcolor="#f0f0f0" -->
<tr><td align="left"><tt>bin/glew32.dll</tt></td><td>&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align="left"><tt>%SystemRoot%/system32</tt></td></tr>
<tr><td align="left"><tt>lib/glew32.lib</tt></td><td>&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align="left"><tt>{VC Root}/Lib</tt></td></tr>
<tr><td align="left"><tt>include/GL/glew.h</tt></td><td>&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align="left"><tt>{VC Root}/Include/GL</tt></td></tr>
<tr><td align="left"><tt>include/GL/wglew.h</tt></td><td>&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align="left"><tt>{VC Root}/Include/GL</tt></td></tr>
</table>
<p>
</p>
<p>
where <tt>{VC Root}</tt> is the Visual C++ root directory, typically
<tt>C:/Program Files/Microsoft Visual Studio/VC98</tt> for Visual
Studio 6.0 or <tt>C:/Program Files/Microsoft Visual
Studio .NET 2003/Vc7/PlatformSDK</tt> for Visual Studio .NET.
</p>
<p>
On Unix, typing <tt>make install</tt> will attempt to install GLEW
into <tt>/usr/include/GL</tt> and <tt>/usr/lib</tt>. You can
customize the installation target via the <tt>GLEW_DEST</tt>
environment variable if you do not have write access to these
directories.
</p>
<h2>Building Your Project with GLEW</h2>
<p>
There are two ways to build your project with GLEW.
</p>
<h3>Including the source files / project file</h3>
<p>
The simpler but less flexible way is to include <tt>glew.h</tt> and
<tt>glew.c</tt> into your project. On Windows, you also need to
define the <tt>GLEW_STATIC</tt> preprocessor token when building a
static library or executable, and the <tt>GLEW_BUILD</tt> preprocessor
token when building a dll. You also need to replace
<tt>&lt;GL/gl.h&gt;</tt> and <tt>&lt;GL/glu.h&gt;</tt> with
<tt>&lt;glew.h&gt;</tt> in your code and set the appropriate include
flag (<tt>-I</tt>) to tell the compiler where to look for it. For
example:
</p>
<p class="pre">
#include &lt;glew.h&gt;<br>
#include &lt;GL/glut.h&gt;<br>
&lt;gl, glu, and glut functionality is available here&gt;<br>
</p>
<p>
Depending on where you put <tt>glew.h</tt> you may also need to change
the include directives in <tt>glew.c</tt>. Note that if you are using
GLEW together with GLUT, you have to include <tt>glew.h</tt> first.
In addition, <tt>glew.h</tt> includes <tt>glu.h</tt>, so you do not
need to include it separately.
</p>
<p>
On Windows, you also have the option of adding the supplied project
file <tt>glew_static.dsp</tt> to your workspace (solution) and compile
it together with your other projects. In this case you also need to
change the <tt>GLEW_BUILD</tt> preprocessor constant to
<tt>GLEW_STATIC</tt> when building a static library or executable,
otherwise you get build errors.
</p>
<p>
<b>Note that GLEW does not use the C
runtime library, so it does not matter which version (single-threaded,
multi-threaded or multi-threaded DLL) it is linked with (without
debugging information). It is, however, always a good idea to compile all
your projects including GLEW with the same C runtime settings.</b>
</p>
<h3>Using GLEW as a shared library</h3>
<p>
Alternatively, you can use the provided project files / makefile to
build a separate shared library you can link your projects with later.
In this case the best practice is to install <tt>glew.h</tt>,
<tt>glew32.lib</tt>, and <tt>glew32.dll</tt> / <tt>libGLEW.so</tt> to
where the OpenGL equivalents <tt>gl.h</tt>, <tt>opengl32.lib</tt>, and
<tt>opengl32.dll</tt> / <tt>libGL.so</tt> are located. Note that you
need administrative privileges to do this. If you do not have
administrator access and your system administrator will not do it for
you, you can install GLEW into your own lib and include subdirectories
and tell the compiler where to find it. Then you can just replace
<tt>&lt;GL/gl.h&gt;</tt> with <tt>&lt;GL/glew.h&gt;</tt> in your
program:
</p>
<p class="pre">
#include &lt;GL/glew.h&gt;<br>
#include &lt;GL/glut.h&gt;<br>
&lt;gl, glu, and glut functionality is available here&gt;<br>
</p>
<p>
or:
</p>
<p class="pre">
#include &lt;GL/glew.h&gt;<br>
&lt;gl and glu functionality is available here&gt;<br>
</p>
<p>
Remember to link your project with <tt>glew32.lib</tt>,
<tt>glu32.lib</tt>, and <tt>opengl32.lib</tt> on Windows and
<tt>libGLEW.so</tt>, <tt>libGLU.so</tt>, and <tt>libGL.so</tt> on
Unix (<tt>-lGLEW -lGLU -lGL</tt>).
</p>
<p>
It is important to keep in mind that <tt>glew.h</tt> includes neither
<tt>windows.h</tt> nor <tt>gl.h</tt>. Also, GLEW will warn you by
issuing a preprocessor error in case you have included <tt>gl.h</tt>,
<tt>glext.h</tt>, or <tt>glATI.h</tt> before <tt>glew.h</tt>.
</p>
<!-- begin footer.html -->
</td></tr></table></body>
<!-- end footer.html -->