mirror of https://github.com/tLDP/LDP
646 lines
16 KiB
Plaintext
646 lines
16 KiB
Plaintext
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
|
|
|
|
<article lang="en">
|
|
<artheader>
|
|
|
|
<title>Nvidia OpenGL Configuration mini-HOWTO</title>
|
|
<titleabbrev>Nvidia-OpenGL-Configuration-mini-HOWTO</titleabbrev>
|
|
|
|
<author>
|
|
<firstname>Robert</firstname>
|
|
<surname>Easter</surname>
|
|
<othername role="mi">B</othername>
|
|
<affiliation>
|
|
<address>
|
|
<email>reaster@comptechnews.com</email>
|
|
</address>
|
|
</affiliation>
|
|
</author>
|
|
|
|
<revhistory>
|
|
<revision>
|
|
<revnumber>v1.1</revnumber>
|
|
<date>Sep 18, 2000</date>
|
|
<authorinitials>rbe</authorinitials>
|
|
</revision>
|
|
</revhistory>
|
|
|
|
<abstract>
|
|
<para>
|
|
This miniHOWTO is about how to install the OpenGL drivers for
|
|
Nvidia graphics cards on Linux. In addition to just installing the
|
|
Nvidia drivers, this mini-HOWTO also explains how to install XFree86, the
|
|
OpenGL Utility library (part of Mesa), the OpenGL Utility Toolkit (glut),
|
|
the full set of OpenGL manpages, and Qt and its OpenGL extension so
|
|
that a user can have a complete runtime and development environment
|
|
for OpenGL applications on Linux.
|
|
</para>
|
|
</abstract>
|
|
|
|
</artheader>
|
|
|
|
<sect1 id="intro">
|
|
<title>Introduction</title>
|
|
|
|
<para>
|
|
This miniHOWTO is about how to install the OpenGL drivers for
|
|
Nvidia graphics cards on Linux. In addition to just installing the
|
|
Nvidia drivers, this mini-HOWTO also explains how to install XFree86, the
|
|
OpenGL Utility library (part of Mesa), the OpenGL Utility Toolkit (glut),
|
|
the full set of OpenGL manpages, and Qt and its OpenGL extension so
|
|
that a user can have a complete runtime and development environment
|
|
for OpenGL applications on Linux.
|
|
</para>
|
|
|
|
<sect2>
|
|
<title>New Versions of this Document</title>
|
|
|
|
<para>
|
|
The lastest version of this mini-HOWTO can be found at:
|
|
</para>
|
|
|
|
<para>
|
|
<ulink url="http://www.comptechnews.com/~reaster/nvgl.txt">http://www.comptechnews.com/~reaster/nvgl.txt</ulink>
|
|
</para>
|
|
</sect2>
|
|
|
|
<sect2 id="copyright">
|
|
<title>Copyright Information</title>
|
|
|
|
<para>
|
|
This document is copyrighted (c) 2000 Robert B. Easter and is
|
|
distributed under the terms of the Linux Documentation Project
|
|
(LDP) license, stated below.
|
|
</para>
|
|
|
|
<para>
|
|
Unless otherwise stated, Linux HOWTO documents are
|
|
copyrighted by their respective authors. Linux HOWTO documents may
|
|
be reproduced and distributed in whole or in part, in any medium
|
|
physical or electronic, as long as this copyright notice is
|
|
retained on all copies. Commercial redistribution is allowed and
|
|
encouraged; however, the author would like to be notified of any
|
|
such distributions.
|
|
</para>
|
|
|
|
<para>
|
|
All translations, derivative works, or aggregate works
|
|
incorporating any Linux HOWTO documents must be covered under this
|
|
copyright notice. That is, you may not produce a derivative work
|
|
from a HOWTO and impose additional restrictions on its
|
|
distribution. Exceptions to these rules may be granted under
|
|
certain conditions; please contact the Linux HOWTO coordinator at
|
|
the address given below.
|
|
</para>
|
|
|
|
<para>
|
|
In short, we wish to promote dissemination of this
|
|
information through as many channels as possible. However, we do
|
|
wish to retain copyright on the HOWTO documents, and would like to
|
|
be notified of any plans to redistribute the HOWTOs.
|
|
</para>
|
|
|
|
<para>
|
|
If you have any questions, please contact
|
|
<email>linux-howto@metalab.unc.edu</email>
|
|
</para>
|
|
</sect2>
|
|
|
|
<sect2 id="disclaimer">
|
|
<title>Disclaimer</title>
|
|
|
|
<para>
|
|
No liability for the contents of this documents can be accepted.
|
|
Use the concepts, examples and other content at your own risk.
|
|
</para>
|
|
|
|
<para>
|
|
All copyrights are held by their by their respective owners, unless
|
|
specifically noted otherwise. Use of a term in this document
|
|
should not be regarded as affecting the validity of any trademark
|
|
or service mark.
|
|
</para>
|
|
|
|
<para>
|
|
Naming of particular products or brands should not be seen
|
|
as endorsements.
|
|
</para>
|
|
</sect2>
|
|
|
|
</sect1>
|
|
|
|
<sect1 id="downloadsw">
|
|
<title>Download the software packages</title>
|
|
|
|
<para>
|
|
First of all, the OpenGL drivers for the Nvidia cards currently require
|
|
a system with Linux kernel 2.2.12 or later. If you don't have it, then
|
|
you will have to upgrade your system's Linux kernel and that is the topic
|
|
of other HOWTOs! But nevertheless, the first step would be do download
|
|
a new kernel at:
|
|
</para>
|
|
|
|
<para>
|
|
<ulink url="http://www.kernel.org/">http://www.kernel.org/</ulink>
|
|
</para>
|
|
|
|
<para>
|
|
XFree86 4.0 or later, preferably 4.01 as of this writing, is also required.
|
|
Its installation will be covered later.
|
|
</para>
|
|
|
|
<para>
|
|
Software packages.
|
|
</para>
|
|
|
|
<para>
|
|
XFree86 4.0.1.
|
|
</para>
|
|
|
|
<para>
|
|
XFree86 comes in three files:
|
|
<itemizedlist>
|
|
<listitem><para>X401src-1.tgz</para></listitem>
|
|
<listitem><para>X401src-2.tgz</para></listitem>
|
|
<listitem><para>X401src-3.tgz</para></listitem>
|
|
<listitem><para>doctools-1.2.tgz</para></listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
|
|
<para>
|
|
Doctools is something it uses to prepare the X documentation.
|
|
</para>
|
|
|
|
<para>
|
|
<ulink url="ftp://ftp.xfree86.org/">ftp://ftp.xfree86.org/</ulink>
|
|
</para>
|
|
|
|
<para>
|
|
Includes glX, the OpenGL X interface functions.
|
|
Each window system (MS Windows, X etc) has to provide the
|
|
platform-specific interfaces between OpenGL and the window system
|
|
to provide for mapping a GL rendering context to a window system
|
|
window.
|
|
</para>
|
|
|
|
<para>
|
|
OpenGL man pages.
|
|
</para>
|
|
|
|
<para>
|
|
XFree86 comes with only the glX man pages. If you want a full set of
|
|
OpenGL man pages, you have to get them yourself.
|
|
<itemizedlist>
|
|
<listitem><para>mangl.tar.Z</para></listitem>
|
|
<listitem><para>manglx.tar.Z</para></listitem>
|
|
<listitem><para>manglu.tar.Z</para></listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
|
|
<para>
|
|
<ulink url="ftp://sgigate.sgi.com:~ftp/pub/opengl/doc/">ftp://sgigate.sgi.com:~ftp/pub/opengl/doc/</ulink>
|
|
</para>
|
|
|
|
<para>
|
|
These man pages are in a format ready to be unpacked into the
|
|
XFree86 source distributions, see below.
|
|
</para>
|
|
|
|
<para>
|
|
Mesa 3.3.
|
|
</para>
|
|
|
|
<para>
|
|
MesaLib-3.3.tar.gz
|
|
</para>
|
|
|
|
<para>
|
|
<ulink url="http://mesa3d.sourceforge.net/">http://mesa3d.sourceforge.net/</ulink>
|
|
</para>
|
|
|
|
<para>
|
|
Provides libGLU (GL Utility). GLU is a library built on top of OpenGL
|
|
to provide some higher level functions for applications. OpenGL
|
|
itself, libGL.so, is considered a low-level library. Many apps make
|
|
use of higher level libs like GLU to get work done.
|
|
</para>
|
|
|
|
<para>
|
|
The main reason to install Mesa when you already have XFree86 4, is to get
|
|
libGLU. GLU is a standard part of most OpenGL installations and is expected
|
|
to be present by lots of programs.
|
|
</para>
|
|
|
|
<para>
|
|
GLUT
|
|
</para>
|
|
|
|
<para>
|
|
glut-3.7.tar.gz
|
|
glut_data-3.7.tar.gz
|
|
</para>
|
|
|
|
<para>
|
|
<ulink url="http://reality.sgi.com/mjk/glut3/">http://reality.sgi.com/mjk/glut3/</ulink>
|
|
</para>
|
|
|
|
<para>
|
|
Glut provides a window system independent interface between OpenGL
|
|
and any supported window system. For instance, on the X Window System, it
|
|
hides the details of using glX functions to setup a window. Programmers
|
|
can write code once and can compile it to work on MS Windows or X, etc
|
|
provided that a GLUT library is available on the target platform.
|
|
</para>
|
|
|
|
<para>
|
|
Like GLU above, GLUT is a standard part of most OpenGL installations.
|
|
Many example programs and even some applications, make use of libglut.
|
|
For instance, The OpenGL Programming Guide (red book) makes use of Glut
|
|
for its example programs.
|
|
</para>
|
|
|
|
<para>
|
|
You need to install GLU and GLUT if you want to be able to compile
|
|
many of the programs that are freely downloadable as source code.
|
|
Some programs may even need them to run if they were linked to them
|
|
dynamically.
|
|
</para>
|
|
|
|
|
|
<para>
|
|
Qt
|
|
</para>
|
|
|
|
<para>
|
|
qt-x11-2.1.0.tar.gz or later version
|
|
</para>
|
|
|
|
<para>
|
|
<ulink url="http://www.troll.no/">http://www.troll.no/</ulink>
|
|
</para>
|
|
|
|
<para>
|
|
Qt is a cross-platform GUI library that makes it easy to create X applications
|
|
with standard GUI elements (widgets) like menubars, scollbars, dropdown lists,
|
|
checkboxes, buttons, multiple document interface, and many other GUI things.
|
|
Using Qt, a program can be compiled for both MS Windows and X without
|
|
changing any code. Its a very popular GUI library and is used to create
|
|
the core libraries of KDE (<ulink url="http://www.kde.org/">http://www.kde.org/</ulink>).
|
|
</para>
|
|
|
|
<para>
|
|
Qt has an extension (qt/ententions/opengl) for OpenGL that provides for
|
|
creating OpenGL rendering contexts in Qt windows. This provides some
|
|
alternative to both GLUT and using the glX functions directly plus the
|
|
added benefit of full access to the excellent qt widgets and
|
|
cross-platform portability.
|
|
</para>
|
|
|
|
<para>
|
|
This is useful if you want to compile or develop programs based on Qt.
|
|
</para>
|
|
|
|
<para>
|
|
NVIDIA drivers.
|
|
</para>
|
|
|
|
<itemizedlist>
|
|
<listitem><para>NVIDIA_kernel-0.9-4.tar.gz</para></listitem>
|
|
<listitem><para>NVIDIA_GLX-0.9-4.xfree401.tar.gz</para></listitem>
|
|
</itemizedlist>
|
|
|
|
<para>
|
|
<ulink url="http://www.nvidia.com/">http://www.nvidia.com/</ulink>
|
|
</para>
|
|
|
|
<para>
|
|
These make a kernel driver: /lib/modules/2.2.16/video/NVdriver
|
|
and libGL.so and libGLcore.so files that go into /usr/lib/ to replace
|
|
and Mesa ones that might be in there. libGL.so is OpenGL. These files
|
|
are nvidia's own hardware accelerated OpenGL implementation.
|
|
</para>
|
|
|
|
<para>
|
|
XFree86 4.0.1 appears to contain the core of Mesa 3.3, however, it is missing
|
|
the libGLU* files which many programs want.
|
|
</para>
|
|
</sect1>
|
|
|
|
<sect1 id="instx">
|
|
<title>Install XFree86</title>
|
|
|
|
<para>
|
|
If you have a version of XFree86 installed already, you may want to move it
|
|
or delete it:
|
|
<screen>
|
|
|
|
cd /usr
|
|
mv X11R6 X11R6-old
|
|
cd /etc
|
|
mv X11 X11-old
|
|
</screen>
|
|
</para>
|
|
|
|
<para>
|
|
If these locations are not correct for your distribution of Linux, you will
|
|
have to look around your filesystem a bit - try looking in /var
|
|
</para>
|
|
|
|
<para>
|
|
<screen>
|
|
|
|
cd /usr/src
|
|
mkdir release
|
|
cd release
|
|
tar -xvzf X401src-1.tgz
|
|
tar -xvzf X401src-2.tgz
|
|
tar -xvzf X401src-3.tgz
|
|
tar -xvzf doctools-1.2.tar.gz
|
|
|
|
-- unpack the man pages (actually, glx pages are already present)
|
|
tar -xvzf mangl.tar.Z
|
|
tar -xvzf manglx.tar.Z
|
|
tar -xvzf manglu.tar.Z
|
|
</screen>
|
|
</para>
|
|
|
|
<para>
|
|
A file has to be edited to allow these man pages to compile/install with
|
|
the rest of the distribution:
|
|
<screen>
|
|
|
|
cd xc/doc/man/GL
|
|
Edit the file: Imakefile
|
|
SUBDIRS = glx gl glu
|
|
</screen>
|
|
</para>
|
|
|
|
<para>
|
|
When you unpacked the man*.tar.Z files above, two new directories
|
|
where added: gl glu
|
|
</para>
|
|
|
|
<para>
|
|
<screen>
|
|
|
|
cd /usr/src/release
|
|
cd doctools-1.2
|
|
make
|
|
make install
|
|
cd ..
|
|
cd xc
|
|
make World
|
|
-- before installing, make sure you have moved or deleted prior installation of X
|
|
make install
|
|
make install.man
|
|
</screen>
|
|
</para>
|
|
|
|
<para>
|
|
When X is up and running (later), try using the xman program to see that the gl,glx,glu
|
|
and glut man pages are in section 3.
|
|
</para>
|
|
</sect1>
|
|
|
|
<sect1 id="instmesa">
|
|
<title>Install Mesa</title>
|
|
|
|
<para>
|
|
Note: This gives you the libGLU* files that are missing in XFree86.
|
|
To completely uninstall any Mesa libs that may have come with Slackware:
|
|
<screen>
|
|
|
|
removepkg mesa
|
|
</screen>
|
|
Procedures vary for other distributions. If there is no clear way to
|
|
uninstall an existing Mesa, then at least confirm where it is installed:
|
|
normally either under /usr or /usr/local. The example below assumes that
|
|
Mesa is installed (or going to get installed) under /usr. Installing
|
|
over an old version is probably harmless. Look for /usr/lib/libMesa*
|
|
or /usr/local/lib/libMesa*
|
|
</para>
|
|
|
|
<para>
|
|
<screen>
|
|
|
|
-- unpack the Glut-3.7 packages ...
|
|
-- Mesa's compile looks for it
|
|
cd /usr/src
|
|
tar -xvzf glut-3.7.tar.gz
|
|
tar -xvzf glut_data-3.7.tar.gz
|
|
|
|
cd /usr/src
|
|
tar -xvzf MesaLib-3.3.tar.gz
|
|
cd Mesa-3.3
|
|
./configure --prefix=/usr --with-glut=/usr/src/glut-3.7
|
|
make
|
|
make install
|
|
</screen>
|
|
</para>
|
|
|
|
<para>
|
|
At this point, Mesa installed its own version of the glx.h include
|
|
files over the ones that XFree86 installed. This will cause some
|
|
programs fail to compile and is corrected by copying the XFree86 GL include
|
|
files from the X source back to your system:
|
|
<screen>
|
|
|
|
cp /usr/src/release/xc/include/GL/*.h /usr/X11R6/include/GL
|
|
</screen>
|
|
</para>
|
|
|
|
</sect1>
|
|
|
|
<sect1 id="instnvidia">
|
|
<title>Install Nvidia OpenGL drivers</title>
|
|
|
|
<para>
|
|
<screen>
|
|
|
|
-- delete the libGL.* files that come with XFree86 / Mesa 3.3
|
|
-- the nvidia libGL.* should replace them
|
|
cd /usr/X11R6/lib
|
|
rm libGL.*
|
|
cd modules/extensions
|
|
rm libGL*
|
|
rm libglx*
|
|
cd /usr/lib
|
|
rm libGL.*
|
|
|
|
cd /usr/src
|
|
tar -xvzf NVIDIA_kernel-0.9-4.tar.gz
|
|
tar -xvzf NVIDIA_GLX-0.9-4.xfree401.tar.gz
|
|
cd NVIDIA_kernel-0.9-4
|
|
make
|
|
cd ..
|
|
cd NVIDIA_GLX-0.9-4.1
|
|
make
|
|
cd
|
|
-- make a basic X config file
|
|
xf86config
|
|
follow the prompts and fill in the information it asks for
|
|
cd /etc/X11
|
|
You must edit XF86Config and set the following:
|
|
vi XF86Config
|
|
Load "dri"
|
|
driver "nvidia"
|
|
"1600x1200" (or your preferred screen resolution)
|
|
copy ttf fonts from Windows into a font directory and add a font path
|
|
|
|
-- note /usr/include/GL should be a symlink to /usr/X11R6/include/GL
|
|
|
|
</screen>
|
|
</para>
|
|
|
|
<para>
|
|
Specifying "nvidia" for the driver in the XF86Config makes that take effect
|
|
each time you startx. But the NVdriver kernel driver will have to be
|
|
loaded each time your system boots using:
|
|
<screen>
|
|
|
|
insmod NVdriver
|
|
</screen>
|
|
</para>
|
|
|
|
<para>
|
|
You can place this command in one of the system startup files, like
|
|
/etc/rc.d/rc.modules
|
|
</para>
|
|
</sect1>
|
|
|
|
<sect1 id="instqt">
|
|
<title>Install Qt</title>
|
|
|
|
<para>
|
|
<screen>
|
|
|
|
cd /usr/local
|
|
tar -xvzf qt-x11-2.1.0.tar.gz
|
|
mv qt-2.1.0 qt
|
|
cd qt
|
|
</screen>
|
|
</para>
|
|
|
|
<para>
|
|
Check qt/configs/linux-g++-shared and make sure no Mesa references are in there,
|
|
like -lMesaGL -lMesaGLU should be -lGL -lGLU. Read the INSTALL file about
|
|
environment variables to setup.
|
|
</para>
|
|
|
|
<para>
|
|
<screen>
|
|
|
|
./configure
|
|
make
|
|
|
|
-- compile the opengl extension
|
|
-- Note that in qt 2.2.0, the OpenGL support has been moved out of extensions
|
|
-- and is now a standard part of the library that is installed if configure
|
|
-- finds OpenGL installed on your system. If you were to not want OpenGL
|
|
-- support in Qt, you'd have to pass the -no-opengl option to configure.
|
|
cd extensions/opengl/src
|
|
|
|
Check the Makefile and ensure there are not Mesa references.
|
|
|
|
make
|
|
ldconfig
|
|
|
|
cd ../examples
|
|
Try compiling and running the examples.
|
|
</screen>
|
|
</para>
|
|
</sect1>
|
|
|
|
<sect1 id="instglut">
|
|
<title>Install GLUT</title>
|
|
|
|
<para>
|
|
Installing GLUT is a bit tricky. I'm not too familiar with imake, the
|
|
program that it uses to manage the Makefiles, and didn't quite see how to
|
|
get GLUT to install to where I wanted it (/usr/lib). It can be done
|
|
manually anyhow:
|
|
</para>
|
|
|
|
<para>
|
|
<screen>
|
|
|
|
cd /usr/src
|
|
tar -xvzf glut-3.7.tar.gz
|
|
cd glut-3.7
|
|
|
|
Read the file: README.linux
|
|
cd linux
|
|
READ the file: README
|
|
cp Glut.cf ..
|
|
cd ..
|
|
Edit Glut.cf: remove any Mesa references.
|
|
Replace any -lMesaGL -lMesaGLU with -lGL -lGLU if needed.
|
|
In particular, replace:
|
|
OPENGL = $(TOP)/../lib/libMesaGL.so
|
|
GLU = $(TOP)/../lib/libMesaGLU.so
|
|
with:
|
|
OPENGL = -lGL
|
|
GLU = -lGLU
|
|
|
|
./mkmkfiles.imake
|
|
cd lib/glut
|
|
cp /usr/src/glut-3.7/linux/Makefile .
|
|
Edit the Makefile: remove any Mesa references.
|
|
Replace any -lMesaGL -lMesaGLU with -lGL -lGLU if needed.
|
|
In particular, replace:
|
|
OPENGL = $(TOP)/../lib/libMesaGL.so
|
|
GLU = $(TOP)/../lib/libMesaGLU.so
|
|
with:
|
|
OPENGL = -lGL
|
|
GLU = -lGLU
|
|
|
|
make
|
|
ln -s libglut.so.3.7 libglut.so
|
|
ln -s libglut.so.3.7 libglut.so.3
|
|
cp -d libglut.* /usr/lib
|
|
cd ..
|
|
cd gle
|
|
-- make a shared lib for libgle
|
|
make
|
|
gcc -shared -o libgle.so.3.7 *.o
|
|
ln -s libgle.so.3.7 libgle.so
|
|
ln -s libgle.so.3.7 libgle.so.3
|
|
cp -d libgle.* /usr/lib
|
|
cd ..
|
|
cd mui
|
|
-- make a shared lib for libmui
|
|
make
|
|
gcc -shared -o libmui.so.3.7 *.o
|
|
ln -s libmui.so.3.7 libmui.so
|
|
ln -s libmui.so.3.7 libmui.so.3
|
|
cp -d libmui.* /usr/lib
|
|
cd /usr/src/glut-3.7
|
|
make SUBDIRS=man Makefiles
|
|
cd man/glut
|
|
make install.man
|
|
ldconfig
|
|
|
|
cd ../../progs/demos/ideas
|
|
-- edit the Makefile, change OPENGL = -lGL and GLU = -lGLU
|
|
make
|
|
./ideas
|
|
-- test compiling some demos
|
|
-- take a look at which libraries have to be linked (-lX11 ...) in
|
|
-- the Makefiles. Qt's tmake program available at www.troll.no
|
|
-- is a quick way to make a Makefile but you have to edit it
|
|
-- and add the -l needed.
|
|
</screen>
|
|
</para>
|
|
</sect1>
|
|
|
|
<sect1 id="fincomm">
|
|
<title>Final comments</title>
|
|
|
|
<para>
|
|
I believe that is about it! At this point you should have a fully functioning
|
|
OpenGL system for running and developing OpenGL apps.
|
|
</para>
|
|
|
|
</sect1>
|
|
</article>
|