JavaOpenGL 1.0a3
©Copyright 1997 Jack Palevich, All Rights Reserved
mailto:javaopengl@palevich.com
The JavaOpenGL Web page is at http://www.palevich.com/3dfx.
Introduction
JavaOpenGL is a set of Java classes that let you program the OpenGL API
on a Windows 95 or Windows NT box. Most of the Open GL API is supported.
JavaOpenGL works both with the stock OpenGL32.dll file supplied by Microsoft,
and the 3Dfx specific version provided as part of Id Software's GLQuake.
I wrote JavaOpenGL 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, SGI, or Microsoft, other
than as a satisfied customer.
How to Install JavaOpenGL
Requirements
In order to install and use JavaOpenGL, you'll need the following:
-
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.
Optionally, you might also want:
-
A 3Dfx compatable 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.
Downloading
JavaOpenGL is available at http://www.palevich.com/3dfx/JavaOpenGL.zip.
To use it, 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 JavaOpenGL directory and
run Install95.bat or InstallNT.bat, depending upon your OS. This will copy
the JavaOpenGL dll file to your system directory.
Uninstalling JavaOpenGL
To un-install JavaOpenGL, cd to the JavaOpenGL directory and run uninstall.bat.
This will delete the JavaOpenGL.dll from your system directory.
Running the Demo
In order to run the demo, you must edit the file JavaMesaTests/Tex.bat:
-
Change the JAVADIR variable to be wherever your Java VM is located.
To run the demo, double-click on Tex.bat. The demo will run, and you will
see a window open that says "Open GL". The window should show a spinning
texture mapped cube. If you have a 3Dfx VooDoo card, the window will be
blank, and you should see the animation on the VooDoo output. (To Quit
close the window. If you can't see the window because you've got a VooDoo
card, type ESC, 'Q', or Shift+F4) Here's a picture of the output:
If you get an error that says something like "program not found", check
that you've edited the JAVADIR variable in Tex.bat.
If you get an error that says something like "Couldn't link class",
check that you've installed OpenGL32.dll, and that you've run install.bat
to install the JavaOpenGL dll.
Programming using JavaOpenGL
About the JavaOpenGL API
JavaOpenGL is based upon:
You can get excellent on-line documentation about Open GL from:
If you have a 3Dfx VooDoo or VooDoo Rush card, you can get a hardware accellerated
version of the OpenGL32.dll library. To use it, copy it to the same directory
as the Java program you've written. e.g. to use it with the tests, copy
it to the JavaMesaTests directory. (Note that the 3Dfx VooDoo OpenGL library
only implements some of OpenGL. Check this web site for details:)
The Java Open GL syntax
The syntax of the Java Open GL bindings is described in Readme.txt.
The JavaOpenGL 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 JavaOpenGL
You normally won't have to recompile JavaOpenGL. However, you might want
to recompile JavaOpenGL to add new functions, or to make it work with a
different version of Java.
There are here are the steps to recompiling JavaOpenGL:
-
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
Java OpenGL is (probably) copyrighted by Leo Chan. JavaOpenGL, which is
my repackaging of this library to use with Windows and OpenGL32.dll,
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 JavaOpenGL.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 licencing requirements.
To Do
-
Implement the glu utility methods.
-
Add error checking.
-
More Windows specific I/O methods.
Release Notes
Version 1.0a3
-
Thanks to Jean-Marc Leang <jeanmarc.leang@ping.be>
Fixed several bugs that kept the samples from working correctly on NT and
if you didn't own a 3Dfx card. Whew! I should test more carefully!
Version 1.0a2
-
Improved the window size so that the size you specify is the content size,
not the total size.
-
Improved the poor-man's event model - You can now get the rawKeyCode, which
has key down and key up info. You can also tell if the mouse moved. (But
you can't tell where it moved, yet...) Now there's enough event info to
write a screen saver.
-
Implemented poor-man's mip-map computation, to simplify programing using
the 3Dfx GLQuake opengl library.
Version 1.0a1
-
First release. This is based upon my JavaMesa 1.0a7 classes.