
                     3Dfx Glide device driver for Mesa 2.5
				(see below for FAQ)


This software is distributed under the terms of the GNU Library
General Public License, see the LICENSE.TXT file for details.



What do you need ?
------------------

	- A PC with a 3Dfx Voodoo Graphics or Voodoo Rush based board
	  (Pure3D, Monster 3D, R3D, Obsidian, Stingray 128/3D, etc.);

	- Mesa 2.5;

	- The 3Dfx Glide library 2.3 or later for your OS (the 2.4 works fine);

	- A compiler supported by the Glide library (Micro$oft VC++ (tested),
	  Watcom (tested), GCC for Linux (tested), etc.);

	- A lot of patience, this is an alpha release.

	- It's nice to have two monitors- one for your normal graphics
	  card and one for your 3Dfx card.  If something goes wrong with
	  an application using the 3Dfx hardware you can still see your
	  normal screen in order to recover.



Tested on:
----------
	Windows 95 - David Bucciarelli
	Windows NT - Henri Fousse
	MS-DOS
	Linux - Daryll Strauss, Brian Paul, David Bucciarelli



What is able to do ?
--------------------

	- It is able accelerate points, lines and polygon with flat
	  shading, gouraud shading, Z-buffer, texture mapping, blending. There
          is also the support for rendering in a window (with a slow trick for
          the Voodoo Graphics (available only for Linux) and at full speed with
	  the Voodoo Rush chipset).



How to compile:
---------------

MS Windows:
-----------

	For the MSVC++:
	- The glide2x.lib and the texus.lib have to be in the default MSVC++
	  lib directory;

	- The Glide headers have to be in the default MSVC++ include directory;

	- You must have the vcvars32.bat script in your PATH;

	- Go to the directory Mesa-2.5 and run the mesafx.bat;

	- The script will compile everything (Mesa-2.5/lib/OpenGL32.{lib,dll},
	  Mesa-2.5/lib/GLU32.{lib,dll}, Mesa-2.5/lib/GLUT32.{lib,dll} and
          Voodoo demos);

	- At the end, you will be in the Mesa-2.5/3Dfx/demos directory;

	- Try some demo (fire.exe, teapot.exe, etc.) in order to check if
	  everything is OK;

	- Remember to copy the Mesa OpenGL32.dll, GLU32.dll and GLUT32.dll in the
          some directory were you run your Mesa based applications.

	- I think that you can easy change the Makefile.fx files in order
	  to work with other kind of compilers;

	- To discover how open the 3Dfx screen, read the sources under
	  the Mesa-2.5/3Dfx/demos directory. You can use the GLUT library or
          the Diego Picciani's wgl emulator.


Linux:
------
	Here are the basic steps for using the 3Dfx hardware with Mesa
	on Linux:

	- You'll need the Glide library and headers.  Mesa expects:
		/usr/local/glide/include/*.h        // all the Glide headers
		/usr/local/glide/lib/libglide2x.so
		/usr/local/glide/lib/libtexus.so

	  If your Glide libraries and headers are in a different directory
	  you'll have to modify the Mesa-config and mklib.glide files.

	- Unpack the MesaLib-2.5.tar.gz and MesaDemos-2.5.tar.gz archives;

	- If you're going to use a newer Mesa/Glide driver than v0.20 then
          unpack the new driver archive over the Mesa directory.

	- There is an small error in the Glide texus.h: two C++ comments (//);
	  You have to translate the comments in C (/*  */) by hand;

	- In the Mesa-2.5 directory type "make linux-glide"

	- Compilation _should_ finish without errors;

	- Set your LD_LIBRARY_PATH environment variable so that the
	  libglide2x.so and Mesa library files can be found.  For example:
	    setenv LD_LIBRARY_PATH "/usr/local/glide/lib:/SOMEDIR/Mesa-2.5/lib"

	- You'll have to run Glide-based programs as root or set the suid
	  bit on executables;

	- Try a demo:
	    cd gdemos
	    su
	    setenv MESA_GLX_FX f
	    ./gears     (hit ESC to exit)

	- You can find the demos especially designed for the Voodoo driver in
	  in the Mesa-2.5/3Dfx/demos directory (type "make" in order to compile
	  everything).
      


Doing more with Mesa & Linux Glide:
-----------------------------------

	When building Mesa with 'make linux-glide' the gltk and glaux
	toolkits are compiled especially for 3Dfx Glide support using
	the fx/Mesa interface defined in GL/fxmesa.h.

	You can use the GL/fxmesa.h interface for your own applications
	if you want.  However, the glaux/gltk toolkits will be retired
	after Mesa 2.5 in favor	of GLUT.

	There's another way to use the Mesa Glide support without these
	special versions of gltk/glaux.  The MESA_GLX_FX environment
	variable can be used to coax most GLX-based programs into using
	Glide (and the __GLUT library is GLX-based__).

        Full-screen 3Dfx rendering:
        ---------------------------

	1. Set the MESA_GLX_FX variable to "fullscreen":

		ksh:
			export MESA_GLX_FX = "fullscreen"
		csh:
			setenv MESA_GLX_FX fullscreen

	2. As root, run a GLX-based program (any GLUT demo on Linux).
	
	3. Be careful:  once the 3Dfx screen appears you won't be able
	to see the GLUT windows on your X display.  This can make using
	the mouse tricky!  One solution is to hook up your 3Dfx card to
	a second monitor.  If you can do this then set these env vars
	first:

		setenv SST_VGA_PASS 1
		setenv SST_NOSHUTDOWN


        Rendering into an X window with the help of the Voodoo hardware:
        ----------------------------------------------------------------

	1. Start your X server in 16 bpp mode (XFree86:  startx -- -bpp 16)

	2. Set the following environment variables:
		export MESA_GLX_FX="window"	// to enable window rendering
		export SST_VGA_PASS=1	// to stop video signal switching
		export SST_NOSHUTDOWN=1	// to stop video signal switching
	    OR
		setenv MESA_GLX_FX window
		setenv SST_VGA_PASS 1
		setenv SST_NOSHUTDOWN 1

	3. As root, try running a GLX-based program

	How does it work?  We use the 3Dfx hardware to do rendering then
	copy the image from the 3Dfx frame buffer into an X window when
	the SwapBuffers() function is called.  The problem with this
	idea is it's slow.  The image must be copied from the 3Dfx frame
	buffer to main memory then copied into the X window.

	You can use glaux/gltk-based programs with the MESA_GLX_FX env var if
	you've compiled the gltk/glaux libraries with 'linux-elf' instead of
	'linux-glide':

		cd Mesa/src-tk
		make realclean
		make linux-elf
		cd ../src-aux
		make realclean
		make linux-elf


        Rendering into an X window with the X11 software driver:
        --------------------------------------------------------

	Undefine the MESA_GLX_FX env var and your GLX-based program will use
	the X11 software driver (the 3Dfx hardware isn't used at all).



Useful Glide Environment Variables:
-----------------------------------

	- To disable the 3Dfx logo, set the FX_GLIDE_NO_SPLASH variable.

	- To disable video signal switching:
		setenv SST_VGA_PASS 1
		setenv SST_NOSHUTDOWN

        - To set the default screen refresh rate:
                setenv SST_SCREENREFRESH=75

          the supported values are 60, 70, 72, 75, 80, 85, 90, 100, 120.


Know BUGS, problems and Hints:
------------------------------

	- maximum texture size: 256x256 (this is an hardware limit);

	- only GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
	  GL_RGB and GL_RGBA texture channels supported (the support
	  don't yet follow all the OpenGL specs);

	- only one context supported;

        - use the glBindTexture extension (standard in OpenGL 1.1) for texture
	  mapping (the old way: glTexImage inside a display list, download
	  the texture map each time that you call the display list !!!);

	- the alpha buffer doesn't yet works but you can use all the glBlend
	  functions that don't use the alpha buffer (all functions without
	  the DST_ALPHA);

	- very simple Bitmap support (but the GLUT and Tk font functions work
	  fine);

	- color index mode not implemented.



Hints and Special Features:
---------------------------

	- the v0.19 introduces a new powerful texture memory manager: the
	  texture memory is used as a cache of the set of all defined texture
	  maps. You can now define several MB of texture maps also with a 2MB
	  of texture memory (the texture memory manager will do automatically
	  all the swap out/swap in
	  texture memory work). The new texture memory manager has also
	  solved a lot of other bugs/no specs compliance/problems
	  related to the texture memory usage.

	- use triangles and quads strip: they are a LOT faster than sparse
	  triangles and quads;

	- the Voodoo driver supports the GL_EXT_paletted_texture. it works
	  only with GL_COLOR_INDEX8_EXT, GL_RGBA palettes and the alpha value
	  is ignored because this is a limitation of the the current Glide
	  version and of the Voodoo hardware. See Mesa-2.5/3Dfx/demos/paltex.c for
	  a demo of this extension.

	- the Voodoo driver directly supports 3Dfx Global Palette extension.
	  It was written for GLQuake and I think that it isn't a good idea
	  to use this extension for any other purpose (it is a trick). See
	  Mesa-2.5/3Dfx/demos/glbpaltex.c for a demo of this extension.

	- (DON'T USE THIS FEATURE: now the the Voodoo driver has a real texture
	  memory manager and support the OpenGL extensions for palette texture maps,
	  I'm thinking to remove this feature in a near future)
	  you can enable the 8bit textures feature using the following driver
	  function just before the texture definitions:

	  #ifdef FX
		  fxMesaTextureUsePalette(1);
	  #endif

	  All textures declared as GL_RGB will be stored using an ad hoc
	  palette with 256 entry and with an 8bit per pixel texture memory
	  usage (again the default 16 bit). The driver and the Texus library
	  have a lot of preprocessing to do (quantization, dithering, etc.)
	  in order to translate the GL_RGB texture to the 8bit format, so
	  don't be surprised if the startup of your program is slow
	  (downloading 35 large textures can requires more than 30 sec !).

        - If you define the env. var. MESA_FX_INFO:
                  export MESA_FX_INFO=1

          you will get some useful statistic.

Did you find a lot BUGs and problems ? Good, send me an email.



FAQ:
----

1. What is 3Dfx?

3Dfx Interactive, Inc. is the company which builds the VooDoo 3-D graphics
chipset (and others) used in popular PC cards such as the Diamond Monster 3D
and the Orchid Righteous 3D (more informations at http://www.3dfx.com).


2. What is Glide?

Glide is a "thin" programming interface for the 3Dfx hardware.  It was
originally written for Windows/Intel but has been ported to Linux/Intel
by Daryll Strauss.

3Dfx, Inc. should be applauded for allowing the Linux version of Glide
to be written.

You can directly program with the Glide library if you wish.  You can
obtain Glide from the "Developer" section of the 3Dfx website: www.3dfx.com
There's a Linux/Glide newsgroup at news://news.3dfx.com/3dfx.glide.linux


3. What is fxmesa?

"fxmesa" is the name of the Mesa device driver for the 3Dfx Glide library.
It was written by David Bucciarelli and others.  It works on both Linux
and Windows.  Basically, it allows you to write and run OpenGL-style programs
on the 3Dfx hardware.


4. What is GLQuake?

Quake is a very popular game from id software, Inc.  See www.idsoftware.com
GLQuake is a version of Quake written for OpenGL.  There is now a Linux
version of GLQuake with works with the Mesa/3Dfx/Glide combo.

Here's what you need to run GLQuake on Linux:
   PC with 100MHz Pentium or better
   a 3Dfx-based card
   Mesa 2.5 libraries:  libMesaGL.so  libMesaGLU.so
   Glide 2.4 libraries:  libglide2x.so  libtexus.so
   GLQuake for Linux.

Also, the windows version of GLQuake works fine with the Mesa OpenGL32.dll,
you have only to copy the Mesa-2.5/lib/OpenGL32.dll in the GLQuake directory
in order to test 'MesaQuake'.


5. What is GLUT?

GLUT is Mark Kilgard's OpenGL Utility Toolkit.  It provides an API for
writing portable OpenGL programs with support for multiple windows, pop-
up menus, event handling, etc.

Check the Mark's home page for more informations (http://reality.sgi.com/mjk_asd).

Every OpenGL programmer should check out GLUT.

GLUT on Linux uses GLX.


6. What is GLX?

GLX is the OpenGL extension to the X Window System.  I defines both a
programming API (glX*() functions) and a network protocol.  Mesa implements
an emulation of GLX on Linux.  A real GLX implementation would requires
hooks into the X server.  The 3Dfx hardware can be used with GLX-based
programs via the MESA_GLX_FX environment variable.


7. Is the Voodoo driver able to use the 4Mb texture memory of
the Pure3D boards ?

Yes, the Voodoo driver v0.20 includes the support for Voodoo
Graphics boards with more than 2Mb of texture memory.


8. Do the Voodoo driver support the Voodoo Rush under Windows ?

Yes, Diego Picciani has developed the support for the Voodoo
Rush but David Bucciarelli has a Pure3D and a Monster3D and Brian Paul
has a Monster3D, so the new versions of the Mesa/Voodoo sometime are
not tested with the Voodoo Rush.


9. Do the Voodoo driver support the Voodoo Rush under Linux ?

No because the Linux Glide doesn't (yet) support the Voodoo Rush.



Thanks to:
----------

Henri Fousse (he has written several parts of the v0.15 and the GLUT
	      emulator for Win);

Diego Picciani (he has developed all the Voodoo Rush support and the wgl
	        emulator);

Daryll Strauss (for the Linux Glide and the first Linux support);

Brian Paul (of course);

Dave 'Zoid' Kirsch (for the LinuxGLQuake and LinuxQ2test ports).

The most update places where find Mesa VooDoo driver related informations are
the Mesa mailing list and my driver WEB page
(http://www-hmw.caribel.pisa.it/fxmesa/index.shtml)


David Bucciarelli (tech.hmw@plus.it)

Humanware s.r.l. 
Via XXIV Maggio 62
Pisa, Italy
Tel./Fax +39-50-554108
email: info.hmw@plus.it
www: www-hmw.caribel.pisa.it


------------------------------------------------------------------------------
File last updated on 14 October 1997 by Brian Paul
