Next Previous Contents

## 4. Display Subsystem-Specific Comments and Notes

## 4.1 FXmame, a glide driver for xmame

The latest version of this driver can be obtained at http://glmame.linuxgames.com.

### Requirements

To run FXmame, you must have:

- A 3Dfx card
- Glide 2x
- The xmame distribution

### Compiling and Installing

FXmame comes in two flavours---xfx and svgafx. The xfx version is designed to run under X11. It uses an X window for input. The svgafx version runs from the console, and uses svgalib for input. Both use the 3Dfx hardware for rendering.

To install FXmame, follow the general instructions for installing xmame. To specify the glide driver, do the following to the Makefile:

- Select either "xfx" or "svgafx" as your display method
- Configure the glide variables to correspond to your glide setup

The FXmame executables are called "xmame.xfx" and "xmame.svgafx"

### Running

FXmame runs with the same parameters and uses the same keyboard commands that xmame.x11 does.

A few extra keyboard commands have been added in the glide driver:

- RIGHTCTRL-A -- toggle antialiasing in vector games
- RIGHTCTRL-B -- toggle bilinear filtering

The glide driver also adds several command-line options:

        -fxgama <value> 3Dfx gamma correction value

Note that in order to display the game options or the fps display in vector games, I have to overlay the game bitmap over the vector display. This is because I circumvent the bitmap entirely in vector games. Drawing the bitmap is a big cpu hog, so you'll notice that the game slows down when you turn on the fps display (I know, not ideal when you want to find out the frame rate...).

### Common Questions (FAQ)

Q: When I run FXmame, it just dumps core.

A: Make sure you are running FXmame as root. Root privileges are required to access the 3Dfx hardware

Q: When I run xmame.xfx, it just hangs at the initial game screen.

A: Are you running KDE? For some reason, I can't get keyboard input under KDE. If you have this problem, switch window managers or use xmame.svgafx instead.

### Present Limitations/Bugs

- Antialiasing isn't working quite as well as it should
- Input problems under KDE

### Future Work

- Optimize the drawing code to update only the changed portions of the game bitmap.

### License

The FXmame code is Copyright 1998 by Mike Oliphant. It may be used and distributed under the terms of the MAME license.

### Version History

v0.5 -- December 11th, 1998 ---------------------------

- implemented long copies in screen update
- added dirty handling. this greatly increases the speed of games that support the dirty update strategy (although most of them are older games that already ran at full speed on modern hardware)
- merged source with xmame b8.1

v0.4 -- October 30th, 1998 --------------------------

- improved alpha handling in vector games - now bitmapped overlays do not dim the screen o added svgalib support (xmame.svgafx) o fixed a tiling bug that gave artifacts on texture tile boundaries

v0.3 -- October 29th, 1998 --------------------------

- got rid of extra lines in vector games o added bitmap overlay in vector games to show options/fps o added antialiasing in vector games

v0.2 -- October 28th, 1998 --------------------------

- added screenshots o added 3Dfx gamma adjustment o added direct acceleration of vector games (still buggy)

v0.1 -- October 27th, 1998 --------------------------

- first public release

### Author

Mike Oliphant `(oliphant@ling.ed.ac.uk)` http://glmame.linuxgames.com

## 4.2 GLmame, an OpenGL driver for xmame

The latest version of this driver can be obtained at: http://www.jausoft.com/glmame.html

### Requirements

To run GLmame you must have:

- An OpenGL implementation
- libjpeg
- hardware 3D acceleration (if you want any kind of framerate)
- the xmame distribution

### Compiling and Installing

Follow the general instructions for installing xmame. To specify the OpenGL driver, do the following in the Makefile:

- Select "xgl" as your display method.
- For runtime printed debug info, add "-DGLDEBUG" to the "GLCFLAGS" variable.
- GLU version 1.2 is recommended (e.g., from SGI). If you use Mesa's GLU, you may have to add "-DGLU_VERSION_1_2" to the "GLCFLAGS".

The GLmame executable is called "xmame.xgl".

### Running

xmame.xgl runs with the same parameters and uses the same keyboard commands that xmame.x11 does.

The program starts up in cabinet mode. While this is pretty, and cool, you'll probably want to actually play in fullscreen mode.

A few extra keyboard commands have been added in the OpenGL driver:

- RIGHT_ALT-A -- toggle antialias filtering (vector)
- RIGHT_ALT-B -- toggle bilinear filtering (raster)
- RIGHT_ALT-C -- toggle cabinet/fullscreen display (both)
- RIGHT_ALT-F -- toggle between fullscreen (max window size) and startup window size (both)
- RIGHT_ALT-O -- toggle draw-bitmap (both; nonsense for raster games, speedup for vector games)
- RIGHT_ALT-T -- toggle phosphor trails (vector)
- RIGHT_ALT-PLUS_PAD -- incr. beam size (vector)
- RIGHT_ALT-MINUS_PAD -- decr. beam size (vector)

The OpenGL driver also adds several command-line options:

        -[no]fullscreen         Start in fullscreen mode
                                (default: disabled)

        -[no]gldblbuffer        Disable/enable double buffering
                                (default: enabled)

        -gltexture_size <int>   Force the max width and height of one
                                texture segment (default: autosize)

        -[no]glforceblitmode /  Force blitter for true color modes 15/32bpp
        -[no]glblit             (default: enabled)

        -[no]glext78 /          Force the usage of GL extension number 78,
        -[no]glext              if available (palletted texture)
                                (default: enabled)

        -[no]glbilinear /       Disable/enable bilinear filtering
        -[no]glbilin            (default: enabled)

        -[no]gldrawbitmap /     Disable/enable drawing the bitmap; e.g.,
        -[no]glbitmap           disable within vector games for a speedup
                                (default: enabled)

        -[no]glcolormod         Disable/enable color modulation (intensity,
        -[no]glcmod             gamma)
                                (default: enabled)

        -glbeam <float>         Set the beam size for vector games
                                (default: 1.0)

        -[no]glalphablending /  Disable/enable alpha blending if available
        -[no]glalpha            (default: enabled)

        -[no]glantialias /      Disable/enable antialiasing
        -[no]glaa               (default: enabled)

        -gllibname /            Choose the dynamically loaded OpenGL
        -gllib <string>         library
                                (default: libGL.so)

        -glulibname /           Choose the dynamically loaded GLU library
        -glulib <string>        (default: libGLU.so)

        -[no]cabview            Don't start/start in cabinet view mode
                                (default: don't start in this mode)

        -cabinet <cabname>      Specify which cabinet model to use
                                (default: glmamejau)

       -glres <string>          Always scale games to <Xres>x<Yres>,
                                keeping their aspect ratio.
                                This overrides the scale options.
                                Use this e.g. for the Vodoo1 gfx cards
                                with: "-glres 640x480"

Three cabinet models are provided. The default, "glmamejau", is designed to look like a standard arcade cabinet, like "glmame". The last one, "trans", is a box with a transparent game screen.

Note that in order to display the game options or the fps display in vector games, the game's bitmap is overlaid above the vector display. Drawing the bitmap is a big cpu hog for some low-end hardware accelerated OpenGL implementations, so you'll notice that the game slows down when the bitmap is overlaid.

Because bitmap overlaying is the default, you can toggle it on and off by pressing the "RIGHT_ALT-O" key, or turn it off at startup by using the command line option "-noglbitmap".

A problem with vector games and the cabinet mode is that some vector points do not reside within the screen coordinates, so you may see some vectors outside of the cabinet's mame display.

*** IMPORTANT! ***

If you have trouble with GLmame, or it is slow, read the "Common Questions" section. Most of the questions people email me are answered here.

### Cabinet Models

Cabinet model information is stored in the "cab" subdirectory of the directory you specified with the ROMPATH variable in the Makefile. Path information specified in xmamerc or with the 'rompath' shell environment variable is currently not used. Each cabinet model has it's own subdirectory. GLmame will first try to load either the user-specified cabinet model (using the -cabinet command-line option), or a model corresponding to the current game name. Failing that, it will use the generic "glmame" model.

A cabinet model directory must contain a geometry file <modelname>.cab, and any .jpg files used for textures on the model. The format of the .cab file will be familiar if you have ever programmed using OpenGL -- it looks much like an OpenGL display list. The format is as follows:

        cabv1.1

This header must be the first 7 characters of the file.

        #<text>

Comment lines begin with '#'

        begin <type>

Begins a geometry object, where type is one of (points, polygon, quads, quad_strip, screen). Each "begin" must be paired with an "end" statement. A "polygon" is specified using one vertex per, well... vertex. "quads" are four-sided polygons, each specified by four vertices in order around the polygon. A "quad_strip" is a series of four-sided polygons, each of which shares an edge with the polygons before and after it in the strip. A "screen" is a quad that defines the actual area in 3D space where the game will be displayed. only one of these should be defined. For more info, look at any description of OpenGL geometry.

        end

Ends the geometry object begun with "begin".

        pointsize <s>

Changes the current pointsize to the corresponding size value (specified as a floating point number between 0.0 and, e.g., 20.0). Note: You cannot use this statement between begin and end!

        color4 <r> <g> <b>

Changes the current color to the corresponding rgb value (specified as floating point numbers between 0 and 1).

        color4 <r> <g> <b> <a>

Changes the current color to the corresponding rgba value (specified as floating point numbers between 0 and 1).

        shading <type>

Sets the shading type. available types are "smooth" (which blends colors from one vertex to the next) or "flat" (which doesn't).

        vertex <x> <y> <z>

Specifies a vertex for the current geometry object as a point in 3-space.

        numtex <num>

Specifies the number of different textures to be loaded. This declaration must precede any "loadtex" call.

        loadtex <num> <width> <height> <filename>

Loads texture number <num> from .jpg file <filename>. The .jpg file *must* be <width> by <height> pixels, and both <width> and <height> must be powers of two (and must conform to the hardware requirements of any 3D card you want the cabinet to work with -- 256x256 for 3Dfx).

        texcoord <xcoord> <ycoord>

Sets the texture coordinate of the next vertex. This specifies where in 2D texture space the vertex lies.

        enable texture

Enables texture mapping (using the currently-selected texture).

        disable texture

Turns off texture mapping.

        settex <num>

Select texture <num> for doing texturing. The texture must previously have been loaded using "loadtex".

        camerapan <num>

Starts the camera pan definition that will be followed by <num> camera transistions. After the last transision definition, the pan sequence must be ended with an "end" statement.

        goto <lx> <ly> <lz> <px> <py> <pz> <nx> <ny> <nz>

Relocates and reorients the camera. The arguments are the same as are used by the OpenGL command "gluLookAt()". The camera is positioned at point <lx,ly,lz>, pointing along vector <px,py,pz>, with "up" normal (the direction that is "up" for the camera) <nx,ny,nz>.

        moveto <lx> <ly> <lz> <px> <py> <pz> <nx> <ny> <nz> <frames>

Moves the camera to a new location (specified as in "goto"). The transition occurs over <frames> frames.

All commands must be on separate lines. Use the (somewhat) commented glmamejau cabinet as an example to work from.

### Common Questions (FAQ)

Q: I am only getting a few frames-per-second. This sucks! What gives?

A1: You're probably running Mesa in software mode. You should read the "README.3Dfx" file in the Mesa distro. Specifically, you need to "setenv MESA_GLX_FX fullscreen".

A2: You don't have a 3D graphics card. Go buy one (see below)!

Q: When I run xmame.xgl, it just dumps core. That's not as much fun as 3D Pacman, now is it?

A1: If you are using a 3Dfx card, make sure you are running xmame.xgl as root. Root privileges are required to access the 3Dfx hardware.

A2: If you're using Mesa and haven't upgraded to v3.0, do so.

Q: When I run xmame.xgl, it just hangs at the initial game screen.

A: Are you running KDE? For some reason, I can't get keyboard input under KDE. If you have this problem, switch window managers.

Q: Which graphics cards are usable with xmame.xgl?

A: We have the following experiences (date 20010713):

- Vodoo3 + DRI OpenGL driver (XFree86 4.0.2), with command line options "-noglaa" and 16bpp X11 server color depth.
- Vodoo1 + Mesa 3.4 + Glide, with command line options "-glres 640x480"!
- GeForce + NVIDIA OpenGL driver + XFree86 4.0.2 with default command line options and 16/24bpp X11 server color depth.
- NVIDIA TNT2 + NVIDIA OpenGL driver + XFree86 4.0.2 with command line options "-bpp 16" and 16bpp (may be 24bpp also ???) X11 server color depth (OpenGL colortable mapping is buggy).
- NVIDIA TNT + NVIDIA OpenGL driver + XFree86 4.0.2 with command line options "-bpp 16" and 16bpp (may be 24bpp also ???) X11 server color depth (OpenGL colortable mapping is buggy).
- Matrox MGA 400 + DRI OpenGL driver (XFree86 4.0.2) with command line options "-bpp 16", "-noglaa" (???) and 16bpp (may be 24bpp also ???) X11 server color depth (OpenGL colortable mapping is buggy).
- ATI R128 + DRI OpenGL driver (XFree86 4.1.0) with command line options "-noglext78 -noglaa" or "-bpp 16 -noglaa", where the latter options are a bit slower (about 5 fps).
- LinuxPPC - Powerbook-Firewire + ATI R128: see above!

All of the above drivers work with the option "-bpp 16" and/or "-noglext78", the latter of which is very slow, of course! So it looks like an OpenGL implementation bug is causing these driver/hardware combinations to only work with these command line options. The bug may lie within these OpenGL functions:

- glColorTableEXT
- glColorSubTableEXT

Currently fast and funny driver/hardware combinations are:

- NVIDIA GeForce + NVIDIA OpenGL driver + XFree86 4.0.2; I have tested the GeForce256 (AGP) hardware.
- Vodoo + DRI OpenGL driver (XFree86 4.0.2); I have tested the Vodoo3 hardware.

Q: When I run xmame.xgl, everything is messed up.

A: Read the above experiences ... and try

- switching your X server's bpp value, e.g. switch from 32bpp or 24bpp to 16bpp;
- the command line option "-bpp 16";
- the command line option "-noglaa";
- the command line option "-noglext".

### Present Limitations/Bugs

- No clipping of vector games (most noticeable in cabinet mode).
- No preservation of game aspect ratio in cabinet mode.

### Future Work

- Fixing existing bugs .. are there any ? Or are there some unknown features only ;-) ?
- Optimize the drawing code to update only the changed portions of the game bitmap. Optimizing the dirty code ..

### License

The GLmame code is based upon Mike Oliphant's GLmame code version 0.6.

The GLMame code is Copyright 1998 by Mike Oliphant. It may be used and distributed under the terms of the MAME license.

Since GLmame version 0.7, the code has been changed and improved heavily by Sven Goethel --- no license change, of course!

### Version History

v0.83 -- March 29th, 2001 ---------------------------

- Changed the code heavily to improve compatibility and speed. The new code is a re-merge of the GLMame32 code, which is a branch of Mike Oliphant's GLmame code version 0.6.
- For a detailed list, please consult the file changes.opengl within the distribution's documentation directory! You can also view the current changes.opengl here: http://www.jausoft.com/glmame.html

v0.6 -- December 14th, 1998 ---------------------------

- added support for systems that do not support paletted textures (SGI and solaris OpenGL implementations, for example)
- merged source with xmame b8.1

v0.5 -- October 30th, 1998 --------------------------

- fixed a bug with texturing being left on in bad places
- added 3Dfx gamma adjustment

v0.4 -- October 21st, 1998 --------------------------

- updated to work with xmame v0.34b5.2

v0.3 -- October 12th, 1998 --------------------------

- fixed verticle screen centering in fullscreen mode
- moved cabinet and camera panning information into a user-editable configuration file
- added 'trans' cabinet model o added double buffer, view type, and cabinet selection command-line options

v0.2 -- October 6th, 1998 -------------------------

- adding missing 'cab' directory

v0.1 -- October 5th, 1998 -------------------------

- first public release

### Authors

Since GLmame version 0.7: Sven Goethel (sgoethel@jausoft.com) http://www.jausoft.com/glmame.html

Till GLmame version 0.6: Mike Oliphant `(oliphant@ling.ed.ac.uk)` http://glmame.linuxgames.com

Next Previous Contents