

		    Instructions for Using GLUT with Mesa


Mark Kilgard's GLUT (OpenGL Utility Toolkit) is a nice OpenGL toolkit
which allows one to write OpenGL applications without having to know
anything about the window system and its interface to OpenGL.  It is
much nicer than the aux and tk toolkits initially used by SGI and
should be preferred over aux or tk when writing new programs.

At this time I'm not including GLUT with Mesa but may do so in the future.
I have successfully compiled and tested GLUT with Mesa on an SGI workstation.
I don't know what problems may pop up on other systems.

In any case, here's what you should do to use version 2.1 of GLUT with Mesa:


1. Ftp to sgigate.sgi.com and go to the pub/opengl/xjournal/GLUT directory.
   Get the glut.2.1.tar.Z file.  Make sure your copy ends up in this dir-
   ectory  (i.e. Mesa/GLUT/).

2. Unpack the GLUT distribution file with:
	zcat glut.2.1.tar.Z | tar xvf -

3. Make a backup copy of Glut.cf in case you want the original:
	cp Glut.cf Glut.cf.orig


4. If you're using a Sun with Solaris then define the following two
   environment variables from your shell:

	OGLHOME	to where you've installed Mesa (maybe /usr/home/brian/Mesa)
	OPENWINHOME to something like /usr/openwin

   Otherwise, edit Glut.cf as follows:

	change:		EXTRA_INCLUDES = -I$(TOP)
	to look like:	EXTRA_INCLUDES = -I$(TOP)/../include -I$(TOP)

	change:		OPENGL = -lGL
	to look like:	OPENGL = $(TOP)/../lib/libMesaGL.a

	change:		GLU = -lGLU
	to look like:	GLU = $(TOP)/../lib/libMesaGLU.a


5. Run the mkmkfiles.imake script:
	mkmkfiles.imake

6. Run make:
	make

7. If all goes well there should be some executables in the progs/
   directories for you to try out.

8. You may want to copy the lib/glut/libglut.a file to wherever you have
   your Mesa libraries (libGL.a, libGLU.a, etc) if you're going to
   use it for your own work.



If something goes wrong during compilation, you're best off trying to
diagnose and fix the problem yourself.  Send me the patches when you figure
out the solution.

If you have run-time problems you can send me an email with a detailed
description of the problem.  I'll see what I can do.

Don't bother Mark Kilgard with problems unless you're absolutely sure
the problem is in the GLUT code.

I know some of the GLUT demos don't work.  Specifically, the dino demos
don't look right because polygon tesselation isn't implemented in Mesa's
GLU library.  Anybody want to write the tesselator code?



How GLUT works with Mesa
------------------------

GLUT makes calls to a number of GLX functions to bind OpenGL to X.  Mesa
hasn't implemented any GLX functions until now.  Philip Brown at Berkeley
implemented the initial pseudo-GLX functions and got GLUT to run with them.
I rewrote much of Philip's GLX code to support more features, more reliably.

If you want to use the GLX functions in your programs be aware that:
	1. they've not been fully tested
	2. they are not as "tight" as the real GLX functions, i.e. what
	   works with Mesa's GLX functions might not work with the real
	   OpenGL/GLX interface.
	3. a number of the functions are only stubs (not implemented)

I'm currently debating whether to support the X/Mesa interface or the
GLX interface, or both.  There are some subtle issues to resolve.


-Brian

