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

Many of the pre-compiled libraries were built before the Fortran interface was changed to use the ISO_C_BINDING interface. For these older versions you would remove the "use M_vogle" line from the Fortran examples and replace this with an INCLUDE of "interface.h", which is the FORTRAN 77 equivalent of


    integer,external :: backbuffer
    integer,external :: checkkey
    integer,external :: getdepth
    integer,external :: getkey
    integer,external :: locator
    external scale
    integer,external :: slocator

You would then compile and load an example Fortran program with something like

  gfortran -L$HOME/VOGLE/Linux -lvogle -lX11 example.f  -o example
  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/`systemtype r`
PATH=$PATH:$HOME/VOGLE/libs/bin/`systemtype r`/EXAMPLES
PATH=$PATH:$HOME/VOGLE/libs/bin/`systemtype 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/`systemtype r`/hershey

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

cd F90
ccall trivial.f90
#(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,f90} file is of most use, followed by views.{c,f90}, and then poly.{c,f90}. When those three work, try the others. loc.{c,f90} 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 Pascal
trivial.c ftrivial.f90 ptrivial.p
simple.c fsimple.f90 psimple.p
textjustify.c ftextjustify.f90
shapes.c fshapes.f90 pshapes.p
poly.c fpoly.f90 ppoly.p
views.c fviews.f90 pviews.p
circtxt.c fcirctxt.f90 pcirctxt.p
moretxt.c fmoretxt.f90 pmoretxt.p
jtext.c fjtext.f90 pjtext.p
getstr.c fgetstr.f90 pgetstr.p
lstyles.c flstyles.c plstyles.p
curves.c fcurves.f90 pcurves.p
patches.c fpatches.f90 ppatches.p
balls.c fballs.f90 pballs.p
objvws.c fobjvws.f90 pobjvws.p
world.c fworld.f90 pworld.p
cube.c fcube.f90 pcube.p
tetra.c ftetra.f90 ptetra.p
loc.c floc.f90 ploc.p
lcube.c 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.