new entry

This commit is contained in:
gferg 2000-08-21 20:46:58 +00:00
parent a7074cf6eb
commit 401eff6537
1 changed files with 758 additions and 0 deletions

View File

@ -0,0 +1,758 @@
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
<article lang="en">
<artheader>
<title>LinuxGL (GLX) QuakeWorld Client compile mini-HOWTO</title>
<titleabbrev>LinuxGL-QuakeWorld-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.0</revnumber>
<date>Aug 19, 2000</date>
<authorinitials>rbe</authorinitials>
</revision>
</revhistory>
<abstract>
<para>
This miniHOWTO is about how to get the OpenGL/GLX Linux QuakeWorld
client compiled and working on systems with standard OpenGL hardware
acceleration support.
</para>
</abstract>
</artheader>
<sect1 id="intro">
<title>Introduction</title>
<para>
This miniHOWTO is about how to get the OpenGL/GLX Linux QuakeWorld
client compiled and working on systems with standard OpenGL hardware
acceleration support.
</para>
<para>
This procedure was developed while struggling to get glqwcl.glx
to work on a system with Linux Slackware 7.0 (2.2.16), XFree86
4.0.1, a GeForce 256 DDR video card, and NVIDIA's 0.9-4 MesaGL
drop-in replacement lib/driver (libGL.so.1.0.4).
</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/linux-glxqw.txt">http://www.comptechnews.com/~reaster/linux-glxqw.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="procedure">
<title>The Procedure</title>
<para>
It seems that the glqwcl.glx binary available at least
at <ulink url="http://www.quakeworld.net/">www.quakeworld.net</ulink>
in the package <filename>qwcl-2.30-glibc-i386-unknown-linux2.0.tar.gz</filename>
is not compiled properly since on startup, it looks
for <filename>libglide2x.so</filename>.
</para>
<para>
QuakeWorld clients come in several flavors:
</para>
<para>
<variablelist>
<varlistentry>
<term>OpenGL:</term>
<listitem>
<para>
glqwcl (3dfx only?)
</para>
<para>
glqwcl.glx (MesaGL/XFree4)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Software only:</term>
<listitem>
<para>
qwcl (svgalib)
</para>
<para>
qwcl.xl1 (x11/svgalib)
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
Again, this miniHOWTO is about getting the glqwcl.glx working with
XFree86 4.x DRI.
</para>
<para>
<orderedlist>
<listitem>
<para>
Download the Quake source code, q1source.zip, from
<ulink url="ftp://ftp.idsoftware.com/idstuff/source/q1source.zip">ftp://ftp.idsoftware.com/idstuff/source/q1source.zip</ulink>.
This zip file contains all versions of Quake1/QuakeWorld.
</para>
<para>
After compiling, you will get version:
<screen>
LinuxGL (0.98) QuakeWorld 2.40 (as of this writing, Aug 19, 2000)
</screen>
</para>
<para>
You will also need to download the Mesa 3D Library source code from
<ulink url="http://mesa3d.sourceforge.net/">http://mesa3d.sourceforge.net/</ulink>.
MesaLib-3.3.tar.gz is good.
<screen>
cd /usr/src
tar -xvzf MesaLib-3.3.tar.gz
<emphasis>This puts the mesa source at /usr/src/Mesa-3.3</emphasis>
</screen>
</para>
<para>
Build the mesa source code:
<screen>
cd /usr/src/Mesa-3.3
./configure --prefix=/usr
make
</screen>
</para>
<para>
Depending on your setup, you might not need to actually install the
Mesa libs, but if you want to:
<screen>
make install
</screen>
</para>
<para>
After you install the full Mesa package, you might need to reinstall
your hardware accelerated libGL files. By installing the Mesa libs,
you will get the libGLU* files and the full Mesa include files
installed on your system. XFree86 4.0.1 appeared to be lacking
libGLU* and some of the header/include files of Mesa.
</para>
<para>
XFree86 4.0.1 appears to have included only the core of Mesa 3.3,
which at the time was/is a development version of MesaGL. The
direct rendering infrusture (DRI) of XFree86 is based on Mesa code.
</para>
</listitem>
<listitem>
<para>
Make a directory to hold the quake source:
<screen>
mkdir q1src
cd q1src
unzip ../q1source.zip
cd QW
cp Makefile.Linux Makefile
</screen>
</para>
</listitem>
<listitem>
<para>
Edit the Makefile:
</para>
<para>
<variablelist>
<varlistentry>
<term>Line 30:</term>
<listitem>
<para>
MAINDIR=/home/&lt;you&gt;/q1src (where you unzipped the source)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Line 37:</term>
<listitem>
<para>
MESA_DIR=/usr/src/Mesa-3.3
or wherever you put the Mesa source code
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Lines 43 and 46:</term>
<listitem>
<para>
You might need to remove all the optimization
compiler flags in order to get a stable binary.
(I did) You can play around with them. For instance,
strange things happened when it opened the pak files
with optimizations on: It would error out saying
there are millions of files in id1/pak0.pak!
</para>
<para>
I removed all of the following RELEASE_CFLAGS:
<screen>
-O6
-ffast-math
-funroll-loops
-fomit-frame-pointer
-fexpensive-optimizations
-malign-loops=2
-malign-jumps=2
-malign-functions=2
</screen>
</para>
<para>
However, further experimentation seemed to show that
at least the following two are ok:
<screen>
-ffast-math
-fexpensive-optimizations
</screen>
</para>
<para>
The really troublesome flag seems to be the -O6
flag. I tried setting it down to -O1 and still had
trouble. The -malign* flags were unnecessary too.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Line 50:</term>
<listitem>
<para>
Add: -DGL_EXT_SHARED
</para>
<para>
This #define is found inside at least
gl_vidlinuxglx.c where it conditionally
compiles some 3DFx/glide-specific code
#ifndef! Without this, the compile will
error with unresolved external functions
related to glide/3dfx.
</para>
<para>
Remove: -I/usr/include/glide
</para>
<para>
Change:
-L/usr/local/src/Mesa-3.0/lib to where you put the
Mesa source: -L/usr/src/Mesa-3.3/lib
</para>
<para>
Remove any other glide references and fix the path to
Mesa source wherever else it is referenced.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Line 73:</term>
<listitem>
<para>
Delete the targets you don't care to have built.
Some of them may not build? Leave just the
glqwcl.glx build target.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
Make sure that you have a symlink from /usr/X11 to
/usr/X11R6. When installing X yourself, you might forget to
do that and some source code and programs look for X there:
<screen>
cd /usr
ln -s X11R6 X11
</screen>
</para>
<para>
Save the Makefile.
</para>
</listitem>
<listitem>
<para>
Fix the mouse hide problem.
</para>
<para>
The quake code, as it is, does not hide the mouse when you use it.
The pointer would remain visible and jitter around a fixed point in
the middle of the screen - very annoying. I found the following simple fix in
a mail archive about glx development at:
<ulink url="http://lists.openprojects.net/pipermail/glx-dev/1999-October/000994.html">http://lists.openprojects.net/pipermail/glx-dev/1999-October/000994.html</ulink>
<screen>
cd q1src/QW/client
edit the file: gl_vidlinuxglx.c
</screen>
</para>
<para>
At the top of the function called install_grabs(void) (Line 234), add the
following code:
<screen>
static void install_grabs(void)
{
/* vars to make blank cursor */
Pixmap blank;
XColor dummy;
char data[1] = {0};
Cursor cursor;
/* make a blank cursor */
blank = XCreateBitmapFromData (dpy, win, data, 1, 1);
if(blank == None) fprintf(stderr, "error: out of memory.\n");
cursor = XCreatePixmapCursor(dpy, blank, blank, &amp;dummy, &amp;dummy, 0, 0);
XFreePixmap (dpy, blank);
Con_Printf("Cursor blanked.\n");
</screen>
</para>
<para>
The 8th parameter to XGrabPointer should be changed from
"None" to "cursor" to use the blank cursor:
<screen>
XGrabPointer(dpy, win,
True,
0,
GrabModeAsync, GrabModeAsync,
win,
cursor,
CurrentTime);
</screen>
(see: man XGrabPointer)
</para>
<para>
This fix might work for the other client builds if you make
similar changes in the appropriate *vid*.c file. As it is,
this creates a memory leak as it allocates another Cursor
object everytime through and doesn't call XFreeCursor() but
this is probably not a problem since I don't think a 1x1
cursor is using much memory. If you want, you can apply the
following patch against <filename>q1src/QW/client/gl_vidlinuxglx.c</filename>
(<command>patch gl_vidlinuxglx.c patchfile</command>). Just cut and paste the
contents between the begin/end patchfile lines into a file
called patchfile (or whatever you want to call it). Save
patchfile in the <filename>q1src/QW/client</filename> directory where
gl_vidlinuxglx.c is. Then run the command:
<screen>
<command>patch gl_vidlinuxglx.c patchfile</command>
</screen>
</para>
<para>
This patch file will make gl_vidlinuxglx.c such that it doesn't have any
memory leak. You can download this patch file at:
<ulink url="http://www.comptechnews.com/~reaster/gl_vidlinuxglx.c.patch">http://www.comptechnews.com/~reaster/gl_vidlinuxglx.c.patch</ulink>.
<screen>
*************************** begin patchfile ************************************
*** q1src-p/QW/client/gl_vidlinuxglx.c Tue Dec 21 18:45:54 1999
--- gl_vidlinuxglx.c Sat Aug 19 20:47:42 2000
***************
*** 1,22 ****
! /*
! Copyright (C) 1996-1997 Id Software, Inc.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License
! as published by the Free Software Foundation; either version 2
! of the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
!
! See the GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program; if not, write to the Free Software
! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
!
! */
#include &lt;termios.h&gt;
#include &lt;sys/ioctl.h&gt;
#include &lt;sys/stat.h&gt;
--- 1,22 ----
! /*
! Copyright (C) 1996-1997 Id Software, Inc.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License
! as published by the Free Software Foundation; either version 2
! of the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
!
! See the GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program; if not, write to the Free Software
! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
!
! */
#include &lt;termios.h&gt;
#include &lt;sys/ioctl.h&gt;
#include &lt;sys/stat.h&gt;
***************
*** 66,71 ****
--- 66,74 ----
static int scr_width, scr_height;
+ /* blank cursor - gets initialized in VID_Init, freed in VID_Shutdown */
+ Cursor cursor;
+
/*-----------------------------------------------------------------------*/
//int texture_mode = GL_NEAREST;
***************
*** 236,243 ****
0,
GrabModeAsync, GrabModeAsync,
win,
! None,
CurrentTime);
#ifdef USE_DGA
XF86DGADirectVideo(dpy, DefaultScreen(dpy), XF86DGADirectMouse);
--- 239,247 ----
0,
GrabModeAsync, GrabModeAsync,
win,
! cursor,
CurrentTime);
+ Con_Printf("Cursor blanked.\n");
#ifdef USE_DGA
XF86DGADirectVideo(dpy, DefaultScreen(dpy), XF86DGADirectMouse);
***************
*** 350,355 ****
--- 354,360 ----
if (!ctx)
return;
+ XFreeCursor(dpy, cursor);
glXDestroyContext(dpy, ctx);
}
***************
*** 602,608 ****
unsigned long mask;
Window root;
XVisualInfo *visinfo;
!
S_Init();
Cvar_RegisterVariable (&amp;vid_mode);
--- 607,617 ----
unsigned long mask;
Window root;
XVisualInfo *visinfo;
! /* vars to make blank cursor */
! Pixmap blank;
! XColor dummy;
! char data[1] = {0};
!
S_Init();
Cvar_RegisterVariable (&amp;vid_mode);
***************
*** 701,706 ****
--- 710,720 ----
Con_SafePrintf ("Video mode %dx%d initialized.\n", width, height);
vid.recalc_refdef = 1; // force a surface cache flush
+
+ blank = XCreateBitmapFromData(dpy, win, data, 1, 1);
+ if(blank == None) fprintf(stderr, "error: out of memory.\n");
+ cursor = XCreatePixmapCursor(dpy, blank, blank, &amp;dummy, &amp;dummy, 0, 0);
+ XFreePixmap(dpy, blank);
}
void Sys_SendKeyEvents(void)
*************************** end patchfile ************************************
</screen>
</para>
<para>
It is then handy to bind some keys at the quake console to toggle mouse
grabbing:
<screen>
bind q "_windowed_mouse 0"
bind w "_windowed_mouse 1"
</screen>
</para>
</listitem>
<listitem>
<para>
Compile (finally!)
</para>
<para>
Just run "make build_release" with no parameters from where
the Makefile is located:
<screen>
cd q1src/QW
make build_release
</screen>
</para>
<para>
If all goes well, you will have a binary,
<filename>glqwcl.glx</filename>, in the
<filename>releasei386-glibc</filename> directory.
Copy glqwcl.glx to another
directory (like "qw") and then from a Quake cd or other quake
installation, copy the id1 directory and any other game
directories you like/have - ctf, Fortress etc - to your new
quakeworld directory.
</para>
<para>
You might want to run it like this from XQF:
<command>glqwcl.glx -width 1280 -height 1024</command>
(or any other resolution your system can support)
</para>
<para>
XQF is a nice program to find QuakeWorld servers and can be
found at: <ulink url="http://www.linuxgames.com/xqf">http://www.linuxgames.com/xqf</ulink>
</para>
<para>
To run the game fullscreen requires starting the game at the
same resolution as your X desktop. If you are running a
desktop environment, you might not be able to hide
everything. The sure way to get a fullscreen experience is
to run XFree86 on its own without any desktop environment or
window manager loaded:
</para>
<para>
<variablelist>
<varlistentry>
<term><command>XFree86 &amp;</command></term>
<listitem>
<para>
This starts X without any desktop environment
or window manager. <filename>/etc/X11/xinit/xinitrc</filename>
normally starts your desktop.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>CTRL-ALT-'-'</command> and <command>CTRL-ALT-'+'</command></term>
<listitem>
<para>
Switches to the resolution you want. Check
your <filename>/etc/X11/XF86Config</filename> if you don't have
any other resolutions available.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>CTRL-ALT-F1</command></term>
<listitem>
<para>
Switches back to the text console.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>xterm -display localhost:0.0 &amp;</command></term>
<listitem>
<para>
All X applications accept a -display command
line argument to tell it which X server to
display on. Every X program is an X server
client. 0.0 represents the screen on F7, 1.0
on F8, etc. localhost is your computer. Its
possible and very common to execute an X
program on one computer but have it display
on some other workstation. localhost could
be an IP address or the dns name of any
computer running X that is accepting
connections from where you run the X client
application program.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>ALT-F7</command></term>
<listitem>
<para>
Switches back to X 0.0. Using xterm, start
XQF or whatever program you use to launch Quake.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>glqwcl.glx -width w -height h</command></term>
<listitem>
<para>
Tell your quake launcher to start it like
this, where w and h are the resolution you
are at. A good resolution is 1024 by 768.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
<listitem>
<para>
<emphasis>HAVE FUN!</emphasis>
</para>
</listitem>
</orderedlist>
</para>
</sect1>
</article>