Next: Geomview.m, Previous: Mathematica, Up: Mathematica

### 9.1 Using Mathematica to generate OOGL files

The package `OOGL.m` allows Mathematica to write graphics objetos 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 do 3D graphics objeto graphics to the file named file.

This package also provides the `Geomview` command which sends a 3D graphics objeto 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 objeto graphics to Geomview as a geom named `Mathematica`. Subsequent usage of `Geomview[`graphics`]` replaces the `Mathematica` objeto in Geomview with the new graphics.
`Geomview[`name`,`graphics`]`
  Sends the 3D graphics objeto 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 objetos 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] := <<OOGL.m

         In[2] := Plot3D[Sin[x + Sin[y]], {x,-2,2},{y,-2,2}]

         Out[2] := -Graphics3D-

This displays graphics in the usual Mathematica way here.

         In[3] := WriteOOGL["math.oogl", %2]

         Out[3] := -Graphics3D-

This displays nothing new but writes the file `math.oogl`. You can now load that file into Geomview on any computer. Alternately, you can use the `Geomview` command to start up a copy of Geomview from within Mathematica.

         In[5] := Geomview[%2]

         Out[5] := -Graphics3D-