diff --git a/LDP/howto/docbook/LinuxGL-QuakeWorld-mini-HOWTO.sgml b/LDP/howto/docbook/LinuxGL-QuakeWorld-mini-HOWTO.sgml new file mode 100644 index 00000000..cd9ca156 --- /dev/null +++ b/LDP/howto/docbook/LinuxGL-QuakeWorld-mini-HOWTO.sgml @@ -0,0 +1,758 @@ + + +
+ + + LinuxGL (GLX) QuakeWorld Client compile mini-HOWTO + LinuxGL-QuakeWorld-mini-HOWTO + + + Robert + Easter + B + +
+ reaster@comptechnews.com +
+
+
+ + + + v1.0 + Aug 19, 2000 + rbe + + + + + + This miniHOWTO is about how to get the OpenGL/GLX Linux QuakeWorld + client compiled and working on systems with standard OpenGL hardware + acceleration support. + + + +
+ + +Introduction + + + This miniHOWTO is about how to get the OpenGL/GLX Linux QuakeWorld + client compiled and working on systems with standard OpenGL hardware + acceleration support. + + + + 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). + + + + New Versions of this Document + + + The lastest version of this mini-HOWTO can be found at: + + + + http://www.comptechnews.com/~reaster/linux-glxqw.txt + + + + + Copyright Information + + + This document is copyrighted (c) 2000 Robert B. Easter and is + distributed under the terms of the Linux Documentation Project + (LDP) license, stated below. + + + + 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. + + + + 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. + + + + 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. + + + + If you have any questions, please contact + linux-howto@metalab.unc.edu + + + + + Disclaimer + + + No liability for the contents of this documents can be accepted. + Use the concepts, examples and other content at your own risk. + + + + 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. + + + + Naming of particular products or brands should not be seen + as endorsements. + + + + + + + + The Procedure + + +It seems that the glqwcl.glx binary available at least +at www.quakeworld.net +in the package qwcl-2.30-glibc-i386-unknown-linux2.0.tar.gz +is not compiled properly since on startup, it looks +for libglide2x.so. + + + +QuakeWorld clients come in several flavors: + + + + + + + OpenGL: + + + glqwcl (3dfx only?) + + + glqwcl.glx (MesaGL/XFree4) + + + + + + Software only: + + + qwcl (svgalib) + + + qwcl.xl1 (x11/svgalib) + + + + + + + + + Again, this miniHOWTO is about getting the glqwcl.glx working with + XFree86 4.x DRI. + + + + + + + + Download the Quake source code, q1source.zip, from + ftp://ftp.idsoftware.com/idstuff/source/q1source.zip. + This zip file contains all versions of Quake1/QuakeWorld. + + + After compiling, you will get version: + + + LinuxGL (0.98) QuakeWorld 2.40 (as of this writing, Aug 19, 2000) + + + + + You will also need to download the Mesa 3D Library source code from + http://mesa3d.sourceforge.net/. + MesaLib-3.3.tar.gz is good. + + + cd /usr/src + tar -xvzf MesaLib-3.3.tar.gz + + This puts the mesa source at /usr/src/Mesa-3.3 + + + + + Build the mesa source code: + + + cd /usr/src/Mesa-3.3 + ./configure --prefix=/usr + make + + + + + Depending on your setup, you might not need to actually install the + Mesa libs, but if you want to: + + + make install + + + + + 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. + + + + 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. + + + + + + Make a directory to hold the quake source: + + + mkdir q1src + cd q1src + unzip ../q1source.zip + cd QW + cp Makefile.Linux Makefile + + + + + + + Edit the Makefile: + + + + + + + Line 30: + + + MAINDIR=/home/<you>/q1src (where you unzipped the source) + + + + + + Line 37: + + + MESA_DIR=/usr/src/Mesa-3.3 + or wherever you put the Mesa source code + + + + + + Lines 43 and 46: + + + 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! + + + I removed all of the following RELEASE_CFLAGS: + + + -O6 + -ffast-math + -funroll-loops + -fomit-frame-pointer + -fexpensive-optimizations + -malign-loops=2 + -malign-jumps=2 + -malign-functions=2 + + + + + However, further experimentation seemed to show that + at least the following two are ok: + + + -ffast-math + -fexpensive-optimizations + + + + + 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. + + + + + + Line 50: + + + Add: -DGL_EXT_SHARED + + + + 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. + + + + Remove: -I/usr/include/glide + + + + Change: + -L/usr/local/src/Mesa-3.0/lib to where you put the + Mesa source: -L/usr/src/Mesa-3.3/lib + + + + Remove any other glide references and fix the path to + Mesa source wherever else it is referenced. + + + + + + Line 73: + + + Delete the targets you don't care to have built. + Some of them may not build? Leave just the + glqwcl.glx build target. + + + + + + + + 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: + + + cd /usr + ln -s X11R6 X11 + + + + + Save the Makefile. + + + + + + Fix the mouse hide problem. + + + + 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: + http://lists.openprojects.net/pipermail/glx-dev/1999-October/000994.html + + + + cd q1src/QW/client + edit the file: gl_vidlinuxglx.c + + + + + At the top of the function called install_grabs(void) (Line 234), add the + following code: + + + 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, &dummy, &dummy, 0, 0); + XFreePixmap (dpy, blank); + Con_Printf("Cursor blanked.\n"); + + + + + The 8th parameter to XGrabPointer should be changed from + "None" to "cursor" to use the blank cursor: + + + XGrabPointer(dpy, win, + True, + 0, + GrabModeAsync, GrabModeAsync, + win, + cursor, + CurrentTime); + + (see: man XGrabPointer) + + + + 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 q1src/QW/client/gl_vidlinuxglx.c + (patch gl_vidlinuxglx.c patchfile). 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 q1src/QW/client directory where + gl_vidlinuxglx.c is. Then run the command: + + + + patch gl_vidlinuxglx.c patchfile + + + + + This patch file will make gl_vidlinuxglx.c such that it doesn't have any + memory leak. You can download this patch file at: + http://www.comptechnews.com/~reaster/gl_vidlinuxglx.c.patch. + + + +*************************** 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 <termios.h> + #include <sys/ioctl.h> + #include <sys/stat.h> +--- 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 <termios.h> + #include <sys/ioctl.h> + #include <sys/stat.h> +*************** +*** 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 (&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 (&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, &dummy, &dummy, 0, 0); ++ XFreePixmap(dpy, blank); + } + + void Sys_SendKeyEvents(void) + +*************************** end patchfile ************************************ + + + + + It is then handy to bind some keys at the quake console to toggle mouse + grabbing: + + + bind q "_windowed_mouse 0" + bind w "_windowed_mouse 1" + + + + + + + + Compile (finally!) + + + + Just run "make build_release" with no parameters from where + the Makefile is located: + + + cd q1src/QW + make build_release + + + + + If all goes well, you will have a binary, + glqwcl.glx, in the + releasei386-glibc 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. + + + + You might want to run it like this from XQF: + glqwcl.glx -width 1280 -height 1024 + (or any other resolution your system can support) + + + + XQF is a nice program to find QuakeWorld servers and can be + found at: http://www.linuxgames.com/xqf + + + + 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: + + + + + + + XFree86 & + + + This starts X without any desktop environment + or window manager. /etc/X11/xinit/xinitrc + normally starts your desktop. + + + + + + CTRL-ALT-'-' and CTRL-ALT-'+' + + + Switches to the resolution you want. Check + your /etc/X11/XF86Config if you don't have + any other resolutions available. + + + + + + CTRL-ALT-F1 + + + Switches back to the text console. + + + + + + xterm -display localhost:0.0 & + + + 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. + + + + + + ALT-F7 + + + Switches back to X 0.0. Using xterm, start + XQF or whatever program you use to launch Quake. + + + + + + glqwcl.glx -width w -height h + + + 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. + + + + + + + + + + + HAVE FUN! + + + + + + + + +
+