NOTE: This file is autogenerated from the Geomview manual.
For references to things not in this file, see the manual.
The manual is distributed in the "doc" subdirectory.
Mathematica Graphics in Geomview or RenderMan
*********************************************
Geomview comes with some Mathematica packages that let you use use
Geomview to display Mathematica graphics. Mathematica is a commercial
mathematical software system available from Wolfram Research, Inc.
There are two ways to do this.
1. Use Mathematica to write a graphics object to a file in OOGL format
or in RIB format.
2. Use Geomview as the default display for all 3D graphics output in
Mathematica.
You can also use these packages to save Mathematica graphics in
RenderMan (RIB) format.
Since the format of Mathematica graphics objects is different from the
OOGL formats, both of these methods involve translating Mathematica
graphics to OOGL format. Geomview is distributed with a Mathematica
package which does this translation. Before doing either of the
above you must install this package.
Using Mathematica to generate OOGL files
========================================
The package `OOGL.m' allows Mathematica to write graphics objects in
OOGL format. To use it, give the command `<< OOGL.m' to Mathematica to
load the package. The `WriteOOGL[FILE,GRAPHICS]' command writes an OOGL
description of the 3D graphics object GRAPHICS to the file named FILE.
This package also provides the `Geomview' command which sends a
3D graphics object to Geomview. The first time you use this command
it starts up a copy of Geomview. Later calls send the graphics to the
same Geomview. There are two ways to use the `Geomview' command.
`Geomview[GRAPHICS]'
Sends the 3D graphics object GRAPHICS to Geomview as a geom named
`Mathematica'. Subsequent usage of `Geomview[GRAPHICS]'
replaces the `Mathematica' object in Geomview with the new
GRAPHICS.
``Geomview[NAME,GRAPHICS]''
Sends the 3D graphics object GRAPHICS to Geomview as a geom named
NAME. You can use multiple calls of this form with different
names to cause Geomview to display several Mathematica objects at once
and allow independent control over them.
% math
Mathematica 2.0 for SGI Iris
Copyright 1988-91 Wolfram Research, Inc.
-- GL graphics initialized --
In[1] := <"riemann"] This displays the
graphics `%3' on the remote host named `riemann'.
`Geomview' recognizes the string `"local"' as a value for
`$DisplayHost'; it forces the graphics to be displayed on the local
machine.
In addition to knowing the name of the machine you want to run Geomview
on, the `Geomview' needs to know the type of that machine (SGI or NeXT).
By default, `Geomview' assumes that it is the same kind of computer as
the one you are running Mathematica on. The `MachType' option lets you
explicitly specify the type of the `DisplayHost' computer; it should be
one of the strings `"sgi"' or `"next"'.
You can use `SetOptions' to change the default `DisplayHost'
and `MachType'. For example,
In[4] := SetOptions[Geomview, DisplayHost->"riemann",
MachType->"sgi"] arranges for `Geomview' to run Geomview on an SGI
workstation named `riemann'.
Transporting Mathematica Files to Geomview by Hand
--------------------------------------------------
The auxilliary function `WriteChunk' is for those who can only use
Mathematica on a non-Unix machine (Mac, PC) or a Unix machine that is
not on a network with an SGI or NeXT. `WriteChunk[FILE, GRAPHICS]'
generates a file named FILE which contains the graphics object GRAPHICS
in the format accepted by `math2oogl'.
You can transfer that file to a computer that has Geomview installed on
it and then use the programs `math2oogl', `oogl2rib', and
`geomview' directly from the shell. These programs are distributed
in the `bin/sgi' (on SGIs) or `bin/next' (on NeXTs)
subdirectory of the Geomview directory, and may have been installed so
that they are on your `path'.
In[1]:= < mma.oogl
to convert it to the OOGL file `mma.oogl' which you can then view
using Geomview. This is the equivalent of the `WriteOOGL' command.
For a result equivalent to the `Geomview' or `Show'
commands, type
math2oogl -togeomview Mathematica geomview < mychunk
The `WriteRIB' command can be emulated from the shell as
math2oogl < mychunk | oogl2rib -n mma.tiff
Details of the Mathematica->Geomview Package
============================================
The `OOGL.m' package uses the external program `math2oogl' to
convert `Graphics3D' objects to OOGL format, because a compiled
external program is able to do this conversion many times faster than
Mathematica.
The converter will sometimes handle colored SurfaceGraphics objects
correctly that Mathematica does not handle correctly, which means that
Geomview[object] sometimes works where Show[object] will give errors.
The converter supports the `Polygon', `Line', and `Point'
graphics primitives, `RGBColor Graphics3D' directives, and
`SurfaceGraphics' objects with or without `RGBColor'
directives, and lists of any combination of these. It silently ignores
all other directives.
The Mathematica to RenderMan conversion is actually a two-step process:
Mathematica->OOGL (math2oogl), and OOGL->RenderMan (oogl2rib). The
math2oogl program has only been tested on SGIs and NeXTs, but could
theoretically compile on any machine. The oogl2rib program depends on
the OOGL (Object Oriented Graphics Language) libraries, which now only
exist on SGI and NeXT machines.
In the `WriteOOGL' and `WriteRIB' commands, filename can either be a
string containing a filename, an `OutputStream' object, or a string
starting with a `!' to send the output to a command. Object can be a
`Graphics3D' object, a `SurfaceGraphics' object, or a list of these.
The packages work best with Mathematica 2.0 or better. With version 1.2,
the Geomview display is always on the local host.
Installing the Mathematica Packages
===================================
If Geomview is properly installed on your system according to the
instructions in *Note Installation::, then the Mathematica-to-Geomview
packages should work as described here; there should be no need for
additional installation procedures. In practice, however, it is
sometimes necessary to taylor the installation of the Mathematica
packages and/or of Geomview itself to suit the needs of a particular
system. This section contains details about how the installation works;
if the Mathematica-to-Geomview connection does not seem to work for you
after following the Geomview installation procedure, consult this
section to see what might need to be fixed.
In this section, the phrase *Geomview installation* refers any of
the procedures in *Note Installation::. The way the Mathematica packages
work and are installed is the same regardless of whether you have
one of the binary distributions or the source distribution.
1. The relevant mathematica files are `OOGL.m', `Geomview.m', and
`BezierPlot.m'; Mathematica must be able to find these files. They
are distributed in the `$GEOMROOT/mathematica' subdirectory of the
binary distributions, and in the
`$GEOMROOT/src/bin/geomutil/math2oogl' subdirectory of the source
distribution. These files need to be in a directory that is on
Mathematica's search path. You can look at the value of the
`$Path' variable in a Mathematica session on your system to see a
list of the directories on Mathematica's search path.
The Geomview installation procedure puts copies of the Mathematica
packages into a directory that you specify (`MMAPACKAGEDIR'). This
should ensure that Mathematica can find them. Alternately, you could
arrange to append the pathname of the Mathmematica package subdirectory
of the Geomview distribution to the `$Path' variable each time you
run Mathematica.
2. The package `OOGL.m' needs to be able to invoke the programs
`geomview', `math2oogl', and `oogl2rib'. The Geomview
installation procedure installs these programs into a directory that you
specify for executables (`BINDIR'). Ideally, this directory should
be on your shell's `$path'. More specifically, it should be on
the `$path' of the shell in which Mathematica runs; the directory
`/usr/local/bin' is usually a good choice. You can see the list of
directories on this path by giving the command `!echo $path' in
Mathematica.
If for some reason you can't arrange for `geomview',
`math2oogl', and `oogl2rib' to be in a directory on the
shell's `$path', you can modify `OOGL.m' to cause it to look
for them using absolute pathnames. To do this, change the definitions
of the variables `$GeomviewPath' and `$GeomRoot', which are
defined near the top of the file. Change `$GeomviewPath' to the
absolute pathname of the `geomview' shell script on your system.
Change `$GeomRoot' to the absolute pathname of the
`$GEOMROOT' directory on your system. If you do this, you should
also make sure there are copies of `geomview', `math2oogl',
and `oogl2rib' in the `$GEOMROOT/bin/sgi' (on an SGI) or
`$GEOMROOT/bin/next' (on a NeXT) directory.
3. The `geomview' shell script, which `OOGL.m' uses to invoke
Geomview, needs to be able to find the geomview executable file (which
is called `gvx' on the SGI and `Geomview.app/Geomview' on the
NeXT). The Geomview installation procedure should have been taken care
of this, but if your Mathematica session doesn't seem to be able to
invoke Geomview, it's worth double-checking that the settings in the
`geomview' script are correct.