VOGLE example programs


These example programs are primarily intended for someone learning how to code using the VOGLE library.

Building the example programs

Building using a pre-compiled VOGLE library:

Assuming you got the precompiled library Linux.tgz and expanded it in $HOME/VOGLE/ using something like

   cd
   mkdir VOGLE
   mv Linux.tgz VOGLE/
   cd VOGLE
   tar xvfz Linux.tgz
You would compile and load an example program with something like
  gfortran -L $HOME/VOGLE/Linux -lvogle -lX11 example.f  -o example
for FORTRAN 77 examples or
  cc       -L $HOME/VOGLE/Linux -lvogle -lX11 example.c  -o example
for C programs.

Before executing the program you would have to set up your environment with something like

  export VDEVICE=X11  # select a default output device
  export VFONTLIB=$HOME/VOGLE/Linux/hershey # point to hershey font directory
  
as described in the user manual. Then just execute your program:
  ./example
  
Details vary depending on what compiler you have, what system you are on, and what shell you are using.

Building from an installation of the libs.tgz file

The ccall(1) command in the script directory can be used to load and compile the FORTRAN 77 and C examples on various platforms.

Add the VOGLE distribution script directory and the appropriate distribution bin directory in your search path. Assuming you expanded the libs.tgz file in $HOME/VOGLE/libs and are using a Bourne-family(sh,ksh88,bash,ash,...) shell, and have built the VOGLE libraries using the "scripts/make.shell" script ...

PATH=$PATH:$HOME/VOGLE/libs/scripts
PATH=$PATH:$HOME/VOGLE/libs/bin/`system r`
PATH=$PATH:$HOME/VOGLE/libs/bin/`system r`/EXAMPLES
PATH=$PATH:$HOME/VOGLE/libs/bin/`system r`/TESTS
export PATH

Set the VFONTLIB and VDEVICE variables as described in the VOGLE user guide:

export VDEVICE=x11
export VFONTLIB=$HOME/VOGLE/libs/`system r`/hershey

Now cd to the C, F77 F90, CC or P sub-directories and enter a ccall(1) command:

cd F77
ccall trivial.f
#(csh/tcsh users should do a 'rehash")
trivial

If that works, you should be able to compile, load, and execute any of the example programs.

If you are developing a new output device driver note that these example programs are very useful for testing new drivers. For new device drivers the trivial.{c,f} file is of most use, followed by views.{c,f}, and then poly.{c,f}. When those three work, try the others. loc.{c,f} can be used for testing the mouse device if you are developing an interface device driver.

From the point of view of learning how to use VOGLE the suggested reading order is below.

C FORTRAN Fortran Pascal
trivial.c ftrivial.f ftrivial.F90 ptrivial.p
simple.c fsimple.f fsimple.F90 psimple.p
shapes.c fshapes.f fshapes.F90 pshapes.p
poly.c fpoly.f fpoly.F90 ppoly.p
views.c fviews.f fviews.F90 pviews.p
circtxt.c fcirctxt.f fcirctxt.F90 pcirctxt.p
moretxt.c fmoretxt.f fmoretxt.F90 pmoretxt.p
jtext.c fjtext.f fjtext.F90 pjtext.p
getstr.c fgetstr.f fgetstr.F90 pgetstr.p
lstyles.c flstyles.c flstyles.c plstyles.p
curves.c fcurves.f fcurves.F90 pcurves.p
patches.c fpatches.f fpatches.F90 ppatches.p
balls.c fballs.f fballs.F90 pballs.p
objvws.c fobjvws.f fobjvws.F90 pobjvws.p
world.c fworld.f fworld.F90 pworld.p
cube.c fcube.f fcube.F90 pcube.p
tetra.c ftetra.f ftetra.F90 ptetra.p
loc.c floc.f floc.F90 ploc.p
lcube.c flcube.f flcube.F90 plcube.p

teapot.c, beer.c, and showg.c are provided for general interest, but are not for a new user.

If you are using SUNVIEW or an X11 toolkit, there are additional examples in the directories sunview, xview and xt in the original distribution file.