javamesa
JavaMesa 1.0a7
one of Jack's Hacks
©Copyright 1997 Jack Palevich, All Rights Reserved
Introduction
JavaMesa is a set of Java classes that let you program the 3dfx Glide-compatible 3D graphics cards using the Mesa 3D Graphics library. Mesa is an Open GL-compatible graphics library. Most of the Open GL API is supported.
I wrote JavaMesa for fun, because I like programming in Java, and I wanted to program my 3dfx card. I hope you find it useful.
I have no affiliation with 3Dfx Interactive, other than as a satisfied customer.
How to Install JavaMesa
In order to install and use JavaMesa, you'll need the following:
A 3Dfx compatible graphics card. You can buy one from Diamond or Orchid.
Glide 2.3 or later graphics device driver. You can get Glide from 3Dfx Interactive.
A Java VM. You can use either Java 1.0.2 or Java 1.1. You can buy a Java VM, or you can get one for free from JavaSoft.
Windows 95 or Windows NT 4.0. You can get Windows 95 from Microsoft.
Download JavaMesa.zip.
Unpack the ZIP file using a program like WinZip. When you unpack it, be sure to unpack it with the directory structure intact.
Once you've unpacked the ZIP file, cd to the JavaMesa directory and run Install.bat. This will copy the JavaMesa dll file to your system directory.
Uninstalling JavaMesa
To un-install JavaMesa, cd to the JavaMesa directory and run uninstall.bat. This will delete the JavaMesa.dll from your system directory.
Running the Demo
In order to run the demo, you must edit the file JavaMesaTests/demo.bat:
Change the JAVADIR variable to be wherever your Java VM is located.
To run the demo, double-click on demo.bat. The demo will run, and you will see a screen that displays a rotating color shaded triangle. The display will remain on the screen for about 10 seconds.
If you get an error that says something like "program not found", check that you've edited the JAVADIR variable in Demo.bat.
If you get an error that says something like "Couldn't link class", check that you've installed Glide, and that you've run install.bat to install the JavaMesa dll.
Programming using JavaMesa
About the JavaMesa API
JavaMesa is made up of three parts:
The Mesa Open GL compatible graphics library, available from Mesa - 3-D graphics library
David Bucciarelli's 3Dfx VooDoo Mesa Drivers from http://www-hmw.caribel.pisa.it/fxmesa/index.shtml
An Unofficial port of OpenGL to Java - The Java to Open GL routines.
You can get excellent on-line documentation about Open GL from:
The syntax of the Java Open GL bindings is described in Readme.txt. The JavaMesa API is basicly the Open GL API that's been slightly Java-ized. Just drop the "gl" or "gu" prefix, and the type postfix, and add the class. Code that looks like this:
glClearDepth(1.0f);
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glTranslatef(1.0f,1.0f,0.0f);
Would turn into this:
import OpenGL.*;
OpenGLwidget gl = new OpenGLwidget();
gl.clearDepth(1.0);
gl.depthFunc(gl.LEQUAL);
gl.enable(gl.DEPTH_TEST);
gl.depthFunc(gl.LESS);
gl.translate(1.0f,1.0f,0.0f);
It doesn't matter what you call the OpenGLwidget object -- you might as well give it a short name like "gl".
Recompiling JavaMesa
You normally won't have to recompile JavaMesa. However, you might want to recompile JavaMesa to add new functions, or to make it work with a different version of Java.
There are here are the steps to recompiling JavaMesa:
Obtain the Mesa 2.2 sources.
Obtain the Glide 2.3 libraries.
Edit the Java class files.
Generate the C stub files
Edit the C implementation files.
Compile and Link the DLL.
You will need a C compiler like Microsoft Visual C++ 4.1 to compile the C code.
Study the file MakeStubs.bat for information on how to generate the stub files. You will have to edit the JAVABASE and JAVAMESASOURCE variables to match your configuration.
Copyrights and Copylefts
Mesa-2.2 is under GNU copyleft. Java OpenGL is (probably) copyrighted by Leo Chan. JavaMesa, which is my repackaging of these two libraries for use with the 3Dfx card is copyrighted by me. What does this mean? It means that if you want to use this code in a game you'll have to talk with Leo Chan to get the rights to use the Java bindings, and to me to get the rights to use the JavaMesa DLL.
Practically speaking, it means you're free to experiment with this code, and to give it away with freeware or shareware. If you plan on making serious money, though, you will have to negotiate with me (and Leo Chan, too.) I expect that most people will just use this library as a stop-gap until there are publicly available 3D graphics bindings for Java that aren't encumbered by licensing requirements.
To Do
Implement the glu utility methods.
Add error checking.
Separate the 3Dfx-specific code into a separate class.
Release Notes
Version 1.0a7
Upgrade to Mesa 2.3b2. Warning: Seems to hang when drawing shaded triangles that are larger than the screen.
Added support for many aux and tk routines. (e.g. auxWireTeapot)
Version 1.0a6
Used version 0.16 of David Bucciarelli's Mesa Voodoo driver.
Used version 2.3b1 of Mesa.
Added support for specifying the height and width of the gl window. Currently this just chooses the resolution of the full-screen mode.
Here are the v0.16 release notes:
* written the quadfunc support (no performance improvement)
* written the support for the new Mesa 2.3beta1 driver interface (Wow ! It is faaaster)
* rewritten the glBitmap support for the Glide 2.3 (~35% slower !)
* written the glBitmap support for the most common case (fonts)
*
* Jack Palevich
* Glide 2.3 porting
*
* Diego Picciani (d.picciani@novacomp.it) Nova Computer s.r.l.
* extended the fxMesaCreateContext() and fxMesaCreateBestContext() functions in order to support also the Voodoo Rush
* tested with the Hercules Stingray 128/3D (The rendering in a window works !)
Version 1.0a5
Set the maximum MipMap level to 9, which is correct for the 3Dfx.
Incorporates version 0.15 of David Bucciarelli's Mesa Voodoo driver. This fixes these bugs (according to the 0.15 release notes.):
* V0.15 - David Bucciarelli (tech.hmw@plus.it) Humanware s.r.l.
* written the GL_LUMINANCE_ALPHA support
* written the GL_ALPHA support
* written the GL_LUMINANCE support
* now SETUP correctly set color for mono color sequences
* written the 9x1,10x1,...,1x9,1x10,... texture map ratio support
* written the no square texture map support
* the fog table is no more rebuild inside setup_fx_units() each time
*
* Henri Fousse (arnaud@pobox.oleane.com) Thomson Training & Simulation
* written (not yet finished: no texture mapping) support for glOrtho
* some change to setup functions
* the fog support is now fully compatible with the standard OpenGL
* rewritten several parts of the driver in order to take advantage of meshes (40% faster !!!)
*
* V0.14 - David Bucciarelli (tech.hmw@plus.it) Humanware s.r.l.
* now glAlphaFunc() works
* now glDepthMask() works
* solved a mipmap problem when using more than one texture
* moved ti, texid and wscale inside the fxMesaContext (now we can easy support more ctx and more boards)
* the management of the fxMesaContext was completly broken !
* solved several problems about Alpha and texture Alpha
* 4 (RGBA) texture channels supported
* setting the default color to white
*
* Henri Fousse (arnaud@pobox.oleane.com) Thomson Training & Simulation
* small change to fxMesaCreateContext() and fxMesaMakeCurrent()
* written the fog support
* setting the default clear color to black
* written cleangraphics() for the onexit() function
* written fxMesaCreateBestContext()
Version 1.0a4
Fixed bugs in fxmesa.c related to glBind and multiple Mip-mapped textures.
Version 1.0a3
Implemented and debugged some of the glu texture routines.
Added kbhit and getch methods for primitive input.
Version 1.0a2
Update to using Glide 2.3. Now this should work on the VooDoo Rush as well as older Glide-compatable cards.
Version 1.0a1
The first release.